Sending Mail out of OOo

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
bschaich
Posts: 18
Joined: Sun Feb 01, 2009 8:05 pm

Sending Mail out of OOo

Post by bschaich »

Hello,
I'm trying to send some email out of OOo and have seen a lot of tips about this on the internet:
  • There are the tipps by Andrew Pitonyak, who gives the hint about using "mailto" with SystemShellExecute. This works fine, until I try to use an attachment. After I tried tons of possibilities, I came to the conclusion that this may not even work, because it would be a security infringement if I could place a link with such syntax that send s email with a local file.
  • OK, then the other possibility: "SimpleCommandMail". Because I'm on MacOS I have to use this one (and not "SimpleSystemMail"). Unfortunately all I ever could do was to bring up the Mail program of Mac OS without initiating a new mail
This is the code I'm using:

Code: Select all

oMailer = createUnoService( "com.sun.star.system.SimpleCommandMail" )
MailProgramm = oMailer.querySimpleMailClient()
NeueNachricht = MailProgramm.createSimpleMailMessage()
NeueNachricht.setRecipient(sRecipient)
NeueNachricht.setSubject( sSubject )

If Len(sRepVor)>0 Then
	attachs(0)= sRepVor
	NeueNachricht.setAttachement(attachs())
End if
Mailprogramm.sendSimpleMailMessage(NeueNachricht, 0 )
To my understanding this should work. But as I said all that ever happens is that the Mail program pops up and that's it.
Could it be that this has something to do with the Mac OS implementation?
Any other tips?

Regards,
Benny
OOo 3.0.X on Mac OSx other
Post Reply