Issue 20746 - problems with css.system.SimpleCommandMail / SimpleSystemMail
Summary: problems with css.system.SimpleCommandMail / SimpleSystemMail
Status: CLOSED IRREPRODUCIBLE
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC All
: P3 Trivial
Target Milestone: ---
Assignee: nospam4obr
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-06 11:00 UTC by paolomantovani
Modified: 2013-02-24 21:07 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description paolomantovani 2003-10-06 11:00:04 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
------------------------------------------------------------------------------------------------
Comment 1 ooo 2003-10-06 12:48:24 UTC
implementation issue
Comment 2 nospam4obr 2003-10-07 06:16:07 UTC
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 ?
Comment 3 nospam4obr 2003-10-07 07:06:26 UTC
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.
Comment 4 paolomantovani 2003-10-07 22:46:12 UTC
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. 
 
Comment 5 nospam4obr 2003-10-08 13:30:24 UTC
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 ? 
Comment 6 paolomantovani 2003-10-09 11:39:53 UTC
> 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
Comment 7 nospam4obr 2003-10-09 11:54:42 UTC
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.
Comment 8 gemal 2003-10-09 15:22:38 UTC
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?
Comment 9 nospam4obr 2003-10-09 15:52:19 UTC
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>

Comment 10 gemal 2003-10-09 16:06:42 UTC
Thanx Oliver!


hmmm.. I dont have permissions to move to invalid..!
please move to invalid since this is a mozilla issue
Comment 11 paolomantovani 2003-10-09 18:32:42 UTC
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
Comment 12 paolomantovani 2003-10-09 23:46:52 UTC
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  
  
Comment 13 nospam4obr 2003-10-13 10:07:22 UTC
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.
Comment 14 paolomantovani 2003-10-22 23:58:59 UTC
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=&apos;%s&apos;</value> 
     </prop> 
     <prop oor:name="bcc"> 
      <value>bcc=&apos;%s&apos;</value> 
     </prop> 
     <prop oor:name="subject"> 
      <value>subject=%s</value> 
     </prop> 
     <prop oor:name="attachment"> 
      <value>attachment=&apos;%s&apos;</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 
Comment 15 nospam4obr 2004-03-01 15:56:02 UTC
Accepted.
Comment 16 nospam4obr 2005-03-03 08:32:59 UTC
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". 
Comment 17 nospam4obr 2005-03-03 08:33:18 UTC
.