[Solved] Macro to Email PDFs using Mac OSX 10.6 & Mail.app

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
alf50
Posts: 129
Joined: Sun Jun 13, 2010 2:55 pm

[Solved] Macro to Email PDFs using Mac OSX 10.6 & Mail.app

Post by alf50 »

I have found several entries in this forum for:

Using a Macro to Email PDFs. I am trying to do this using Mac OSX 10.6 & its Mail.app.

I get to a point where the Macro provided will open Mail.app, and inserts the desired xx.pdf file in the body of the email message.

But the Mail Recipient and subject lines fields are not filled in, event though I enter the name and subject line in the macro.

Inserted is the code I used:

Code: Select all

sub send_email
Dim eMailAdress as String
Dim eSubject as String
Dim eMailer as Object
Dim eMailClient as Object
eMailAdress = "alf@att.net"
eSubject = "Results"
'--------
eMailer = createUnoService("com.sun.star.system.SimpleCommandMail")
eMailClient = eMailer.querySimpleMailClient()
eMessage = eMailClient.createSimpleMailMessage()
eMessage.SetRecipient( eMailAdress )
eMessage.SetSubject( eSubject )
eMessage.setAttachement _
(Array(convertToUrl("Users/user/Documents/ORB/xx.pdf")))
eMailClient.sendSimpleMailMessage ( eMessage, _
com.sun.star.system.SimpleMailClientFlags.NO_USER_INTERFACE )
'---------
End sub
From what I have read, this Macro should send out the email without even displaying the Mail.app interface. Please let me know what I am doing wrong.

Thanks, alf50
Last edited by alf50 on Fri Feb 25, 2011 5:31 pm, edited 2 times in total.
OpenOffice 4.1.14 on Mac Catalina(10.15.7), RasPi4B (TwisterOS-8/2023update) & MS Wnds10
User avatar
alf50
Posts: 129
Joined: Sun Jun 13, 2010 2:55 pm

Re: [Solved] Macro to Email PDFs using Mac OSX 10.6 & Mail.a

Post by alf50 »

I found an Applescript that will email the xx.pdf file from a specific directory on a Macintosh using it's standard Mail.app.

[SOLVED] Windows 7 Live Mail has a setting under "Tools-Safety Options-Security" that says:
"_ Warn me when other applications try to send mail as me." Just UNCHECK the box and "FULL AUTOMATION"
works just fine.

On a Windows 7 PC, the following code Almost works the way I want it to.
The only problem I have is that it brings up a dialog box in "Windows Live Mail" asking if I want to send the Email message, Rather than JUST SENDING THE EMAIL. Is there an extra flag that will turn that dialog box OFF? Note that I used the xxxFlags.NO_USER_INTERFACE Flag, but Windows still forces the interface.

Code: Select all

Sub send_email
Dim eMailAddress as String
Dim eSubject as String
Dim eMailer as Object
Dim eMailClient as Object
  eMailAddress = "MyName@MyServer.net" 
  eSubject = "Results" 
eMailer = createUnoService( "com.sun.star.system.SimpleSystemMail" )     
   eMailClient = eMailer.querySimpleMailClient()     
   eMessage = eMailClient.createSimpleMailMessage()     
   eMessage.setRecipient(eMailAddress) 
   eMessage.setSubject(eSubject) 
   eMessage.setAttachement (Array(convertToUrl("c:/Users/User/Documents/ORB/xx.pdf")))
'rem   eMailClient.sendSimpleMailMessage( eMessage, 0 ) 
   eMailClient.sendSimpleMailMessage ( eMessage,com.sun.star.system.SimpleMailClientFlags.NO_USER_INTERFACE )
End Sub
Last edited by alf50 on Fri Feb 25, 2011 5:32 pm, edited 2 times in total.
OpenOffice 4.1.14 on Mac Catalina(10.15.7), RasPi4B (TwisterOS-8/2023update) & MS Wnds10
PGAGA
Volunteer
Posts: 481
Joined: Sun Dec 07, 2008 10:54 pm

Re: Macro to Email PDFs using Mac OSX 10.6 & Mail.app

Post by PGAGA »

Friday, February 25, 2011

The extension which enables one to save an open OOo file as a PDF and send it with Mail.app is MultiDiff:

http://extensions.services.openoffice.o ... /MultiDiff

Phil
OpenOffice.org 3.2.x, StarOffice 5.1, 7, 8 - OS X, WinXP, OS/2
StarOffice 7, 8, Oracle Open Office 3.3.1, LibreOffice 3.x.x - OS X, Ubuntu, WinXP
NeoOffice 2.2.6, 3.1.2, 3.2.x 3.3 - OS X
Apache OpenOffice 3.4.x - WinXP, OS X, OS/2
Post Reply