Apache OpenOffice (AOO) Bugzilla – Issue 118736
XMailMessage methods do not work
Last modified: 2017-05-20 10:31:49 UTC
With the fix to bug 111508 it is now possible using Basic to create an email message with a body and an attachment and send it using the XMailServer interface. (Sample code at www.oooforum.org/forum/viewtopic.phtml?p=462063#462063) For this to work the python-UNO bridge has to be installed, which should not be necessary for Basic scripting. More seriously, the mail message created by com.sun.star.mail.MailMessage does not support the documented methods of the XMailMessage interface to add recipients and attachments: if they are used an error is thrown when an attempt is made to send the message.
(In reply to comment #0) > With the fix to bug 111508 it is now possible using Basic to create an email > message with a body and an attachment and send it using the XMailServer > interface. (Sample code at > www.oooforum.org/forum/viewtopic.phtml?p=462063#462063) > > For this to work the python-UNO bridge has to be installed, which should not be > necessary for Basic scripting. the UNO component is implemented in Python, so you need Python and PyUNO (both installed by default in vanilla OpenOffice.org). > More seriously, the mail message created by com.sun.star.mail.MailMessage does > not support the documented methods of the XMailMessage interface to add > recipients and attachments: if they are used an error is thrown when an attempt > is made to send the message. can you attach a test document with a sample macro?
Created attachment 77128 [details] Demo macro: choose your error Tests the four add...() methods. Errors on send with all but addBccRecipient() and addAttachment() when there was no existing attachment. But addAttachment() doesn't add the attachment.
Created attachment 77138 [details] mailmerge.py modified version
@DonJaime: please try the attached version of mailmerge.py All methods should work now: * addRecipient * addCcRecipient * addBccRecipient * getRecipients * getCcRecipients * getBccRecipients * addAttachment * getAttachments Setting the writable properties * ReplyToAddress * Subject * Body leads to a deadlock (at least in Linux). Your code may need some changes. I'll try to make a AOO Basic demo, when I have time left.
Fixed in revision 1232130
Created attachment 77145 [details] BASIC mailer with flexible test rig In one module there is a sendMail macro, in the other a test macro and various support functions. Varying all the options I can only find two remaining problems: 1. If I choose a secure connection, I get an error that this Python doesn't support SSL (independently of the capabilities of the server). (It may be relevant that I'm using Windows XP) 2. There is no timeout. So if you choose the wrong port or the server is unresponsive, OOo hangs.
(In reply to comment #6) > Created attachment 77145 [details] > BASIC mailer with flexible test rig > > In one module there is a sendMail macro, in the other a test macro and various > support functions. Varying all the options I can only find two remaining > problems: > > 1. If I choose a secure connection, I get an error that this Python doesn't > support SSL (independently of the capabilities of the server). (It may be > relevant that I'm using Windows XP) I'll have to investigate this. > 2. There is no timeout. So if you choose the wrong port or the server is > unresponsive, OOo hangs. Can you please open a new issue for this one? Assign it directly to me. Thanks for testing.
> Can you please open a new issue for this one? > Assign it directly to me. Bug 118814. I don't think I can assign.