Issue 118736 - XMailMessage methods do not work
Summary: XMailMessage methods do not work
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: current
Hardware: All All
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: Ariel Constenla-Haile
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-07 17:20 UTC by DonJaime
Modified: 2017-05-20 10:31 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Demo macro: choose your error (10.73 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-01-13 10:48 UTC, DonJaime
no flags Details
mailmerge.py modified version (16.93 KB, text/plain)
2012-01-16 19:05 UTC, Ariel Constenla-Haile
no flags Details
BASIC mailer with flexible test rig (16.10 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-01-18 13:34 UTC, DonJaime
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description DonJaime 2012-01-07 17:20:02 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.
Comment 1 Ariel Constenla-Haile 2012-01-07 17:39:26 UTC
(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?
Comment 2 DonJaime 2012-01-13 10:48:07 UTC
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.
Comment 3 Ariel Constenla-Haile 2012-01-16 19:05:21 UTC
Created attachment 77138 [details]
mailmerge.py modified version
Comment 4 Ariel Constenla-Haile 2012-01-16 19:10:40 UTC
@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.
Comment 5 Ariel Constenla-Haile 2012-01-16 19:52:28 UTC
Fixed in revision 1232130
Comment 6 DonJaime 2012-01-18 13:34:37 UTC
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.
Comment 7 Ariel Constenla-Haile 2012-01-18 14:01:51 UTC
(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.
Comment 8 DonJaime 2012-01-18 16:14:54 UTC
> Can you please open a new issue for this one?
> Assign it directly to me.

Bug 118814. I don't think I can assign.