Send email using a macro
Posted: Tue Jul 03, 2018 11:14 am
Hi, I want to send an email with a pdf attached with a macro in OpenOffice.
I searched in the forum and I found this lines:
The problem is that the program runs without any error, but it doesn't send the email: it just open my client email service and also doesn't fill the email, the subject and the body fields.
I tried both Mail(an Apple program) and Thunderbird with no results.
Can anyone help me?
I searched in the forum and I found this lines:
Code: Select all
sub sendEmail
Dim eMailAddress as String
Dim eSubject as String
Dim eMailer as Object
Dim eMailClient as Object
eMailAddress = "email@gmail.com"
eSubject = mailSubject
eMailer = createUnoService("com.sun.star.system.SystemMailProvider")
eMailClient = eMailer.queryMailClient()
eMessage = eMailClient.createMailMessage()
eMessage.Recipient = eMailAddress
eMessage.Subject = "subject"
eMessage.Body = "The text in the message"
AttachmentURL = convertToUrl(URLDestinazione & Sheet.getCellByPosition(0,currLine+primaRiga).string & ".pdf")
eMessage.Attachement = Array(AttachmentURL)
eMailClient.sendMailMessage ( eMessage, com.sun.star.system.MailClientFlags.NO_USER_INTERFACE )
End sub
I tried both Mail(an Apple program) and Thunderbird with no results.
Can anyone help me?