Apache OpenOffice (AOO) Bugzilla – Issue 20746
problems with css.system.SimpleCommandMail / SimpleSystemMail
Last modified: 2013-02-24 21:07:24 UTC
I'm playing with css.system.SimpleCommandMail and css.system.SimpleSystemMail but I encounteered following problems: This is the test code I'm using: ------------------------------------------------------------------------------------------------ REM ***** BASIC ***** Sub Test_Email_API oMailService = createUnoService("com.sun.star.system.SimpleSystemMail") If IsNull(oMailService) Then oMailService = _ createUnoService("com.sun.star.system.SimpleCommandMail") End If On Error GoTo ErrH oMailClient = oMailService.querySimpleMailClient() oMailMessage = oMailClient.createSimpleMailMessage() oMailMessage.Attachement = Array("file:///home/paolo/test.sxw") '*** oMailMessage.Subject = "ciao" oMailMessage.Recipient = "test@email.com" oMailClient.sendSimpleMailMessage( _ oMailMessage, com.sun.star.system.SimpleMailClientFlags.DEFAULTS) Exit Sub ErrH: MsgBox "Error opening email client.", 16 End Sub ------------------------------------------------------------------------------------------------ I've tried this code under different conditions and my results are: ------------------------------------------------------------------------------------------------ System: MDK9.1 - Kmail 1.5 - Mozilla1.3 - Evolution1.2 - OOo1.1RC3 (Italian) (***before to run the code, change the URL to an existing file) Test 1: OOo configured with KMail as default email client (/usr/bin/kmail): a new message appears but the attachements and the subject are missing. But commenting the lfollowing lines: REM oMailMessage.Subject = "ciao" REM oMailMessage.Recipient = "test@email.com" the attachement appears... In substance, it works perfectly only if I set one property but not for two or more properties. Another strange effect is the following: Changing the code in this way: REM oMailMessage.Attachement = Array("file:///home/paolo/test.sxw") oMailMessage.Subject = "hello word" REM oMailMessage.Recipient = "test@email.com" you get a message with subject = "hello" email address = "word" Test2: OOo configured with Evolution as default email client (/usr/bin/evolution): Works well for the Recipient and Subject. The attachement is missing. Test3: OOo configured with "Mozilla 1.x (Option 2)" as default email client (/usr/bin/mozilla): All works fine, but only if the subject does not contains spaces :-( changing the subject in this way, f. e. : oMailMessage.Subject = "hello word" In the created message, the text after the space is missing. Also the attachement is missing. ------------------------------------------------------------------------------------------------ System: Windows 98 SE, Mozilla 1.3 OOo1.1RC3 (Italian) (***before to run the code, change the URL to an existing file) Test 4: OOo configured with "System default email program" option (Outlook Express as default email program) All works perfectly Test 5: OOo configured with "System default email program" option (Thunderbird 0.6 (a mozilla derivative) as default email program) All works perfectly BUT before the email address appears the string "SMTP:" this string makes the address invalid, unless you specify the address in this format: "username<email@address.com>" In the message, you'll still have the "SMTP:" before the address: "SMTP:username<email@address.com>" But in this way the address is valid. ------------------------------------------------------------------------------------------------ System: Windows XP Professional SP1, OE6.0, Mozilla 1.3 OOo1.1RC3 (Italian) (***before to run the code, change the URL to an existing file) Test 6: OOo configured with "System default email program" option (Outlook Express 6.0 as default email program) all seems works but OOo freezes :-( Test 7: OOo configured with "System default email program" option (Mozilla 1.3 as default email program) It works but same behaviour as in the test 5 ------------------------------------------------------------------------------------------------
implementation issue
Hi Paolo, I have to admit that everything else but adding an attachment is fairly untested, mostly because it is not used from the office code. Do you have an urgent need for the additional functionality ?
The behavior you describe in Test 5 and Test 7 are most probably bugs in mozilla/firebird, since the code in OOo for "System default email program" is the same regardless of the mailer actually invoked.
Hi Oliver, > Do you have an urgent need for the additional functionality ? No, I don't. (But thank you for asking me :-) I used this service in a macro that I shared with the community. No urgent business to do! For the moment, I think to redesign the code for simply open the new email with attachement, but without address or subject. this seems to work in every situation. > The behavior you describe in Test 5 and Test 7 are most probably bugs > in mozilla/firebird, since the code in OOo for "System default email > program" is the same regardless of the mailer actually invoked. Ok, maybe I'll try to open an issue on mozilla or thunderbird.
I just confirmed that MAPI does require the SMTP: prefix, so it's clearly a mozilla/thunderbird bug not to remove it. On the unix side: did you try to achieve the same results by invoking the mailers directly ?
> I just confirmed that MAPI does require the SMTP: prefix, so it's > clearly a mozilla/thunderbird bug not to remove it. Well, I've just added the issue for the mozilla team: http://bugzilla.mozilla.org/show_bug.cgi?id=221673 > On the unix side: did you try to achieve the same results > by invoking the mailers directly ? Sorry but I cannot understand (please be patient, my English is very poor) What do you mean for "invoking the mailers directly" ? Perhaps means "Not by OOo API's" ? Should I invoke the mail client by a shell command (passing subject, addresses and attachement Url's as arguments)? Thank you Paolo Mantovani
Yes, I meant invoking the mailer(s) from a shell. This would help identifying the problem: if you are able to create a message with subject, receipient and subject from a shell, but not within OOo, it is obviously an OOo problem. If it does not even work from the command line, it's probably an issue with the mailer itself.
Oliver Braun: you write: "I just confirmed that MAPI does require the SMTP: prefix, so it's clearly a mozilla/thunderbird bug not to remove it." where did you see this?
Henrik Gemal wrote: >> where did you see this? In the Platform SDK Docu for MapiRecipDesc in the description of lpszAddress parameter: <QUOTE>Examples of valid addresses are FAX:206-555-1212 and SMTP:M@X.COM. </QUOTE>
Thanx Oliver! hmmm.. I dont have permissions to move to invalid..! please move to invalid since this is a mozilla issue
Before to move to invalid let me check the unix side. Or perhaps should we close this issue and open a new one for the linux/unix side only? -- I think to be able to check Kmail and maybe Evolution from the command line. regarding mozilla: sorry, I've not understood how to create a new message, adding addresses and subject and attachements by the command line. Hope someone else can do the check or point me in the right direction Paolo Mantovani
I do a test under Linux/MDK9.1 with the following command: [paolo@localhost paolo]$ kmail --composer -s "ciao a tutti" --attach file:///home/paolo/test.sxw test@mail.com and it worked well. Sorry, I've not been able to do the same test for mozilla and evolution because I did not find the arguments for adding subject and attachements. Paolo Mantovani
O.k., here are the results of my tests on unix: the first line is produced via File->Send Document As Email, the second one is created with the basic script in this issue. Mozilla (Option 2): -compose attachment='file:///tmp/svpno.tmp/noname3.sxw' -compose to='test@email.com',subject='ciao',attachment='file:///home/paolo/test.sxw' Mozilla (Option 1): -compose "attachment='file:///tmp/svpno.tmp/noname2.sxw'" -compose "to='test@email.com',subject='ciao',attachment='file:///home/paolo/test.sxw'" KMail: --composer --attach file:///tmp/svpno.tmp/noname1.sxw --composer test@email.com Evolution: mailto:?attach=file:///tmp/svpno.tmp/noname0.sxw mailto:?to=test@email.com&subject=ciao&attach=file:///home/paolo/test.sxw Looking at these results, I can confirm the KMail and Mozilla Option 2 issue. Could you please try evolution with the command line above. As a second try, remove the "file://" from the attach parameter and try again.
Hi, looked in my Common.xcu Mozilla Option2 / Netscape Option2 : I think that all it's correct but when soffice does the callee it should replace any spaces in subject and body with %20 Mozilla Option1 / Netscape Option1 : what is this Option1 for? why this double quoting? doesn't work for me. I tried to replace in my Common.xcu all Netscape - Mozilla entries with this one: <node oor:name="Mozilla-Netscape-Thunderbird" oor:op="replace"> <node oor:name="FormatStrings"> <prop oor:name="base"> <value>-compose %s</value> </prop> <prop oor:name="from"> <value/> </prop> <prop oor:name="to"> <value>to=%s</value> </prop> <prop oor:name="cc"> <value>cc='%s'</value> </prop> <prop oor:name="bcc"> <value>bcc='%s'</value> </prop> <prop oor:name="subject"> <value>subject=%s</value> </prop> <prop oor:name="attachment"> <value>attachment='%s'</value> </prop> <prop oor:name="body"> <value>body=%s</value> </prop> </node> <node oor:name="EnumDelimiters"> <prop oor:name="base"> <value>,</value> </prop> <prop oor:name="cc"> <value>,</value> </prop> <prop oor:name="bcc"> <value>,</value> </prop> <prop oor:name="attachment"> <value>,</value> </prop> </node> </node> Works quite well, under linux and windows, but I need to replace manually all spaces with %20, before to call the SimpleCommandMail service KMail: Found a little error: the -b option it's used Bcc field and for Body field. The second should be --body Apart from this, all seems Ok, but soffice seems unable to pass more than one option when calling kmail Evolution: Probably the problem is simply evolution.... Currently I cannot install 1.4 (too much dependencies for my modem) but I've done a quick test in a friend's pc with RH and evolution 1.4 calling: evolution mailto:?attach=file:///home/paolo/test.txt works perfectly. This does not work with previous versions, infact, in evolution1.2 there's a specific binary for creating mail with attachements: [paolo@localhost paolo]$ evolution-launch-composer --help Usage: evolution-launch-composer [OPTION...] [....] Opzioni evolution-launch-composer -a, --add-attachment=ARG An attachment to add. -t, --content-type=ARG Content type of the attachment. -f, --file-name=ARG The filename to display in the mail. -d, --description=ARG Description of the attachment. -i, --show-inline Mark attachment to be shown inline by default. -s, --subject=ARG Default subject for the message. This specific program is not included in evolution 1.4, I think because meantime they have fixed the "mailto:" things
Accepted.
The implementation of SimpleCommandMail on unix has changed significantly, so I propose to re-evaluate if the described problems still exist. Feel free to re-open this task if they do (or submit a new issue if you find other problems). Meanwhile I close this task as "WORKSFORME".
.