Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Launching the system mail reader
Launching the system mail reader [message #453925] Thu, 14 April 2005 01:32 Go to next message
Mark McLaren is currently offline Mark McLarenFriend
Messages: 45
Registered: July 2009
Member
Is there any way SWT can launch the system mail app, and create a new
email ready to send? If not cross-platform, perhaps some dodgy
activex...?

Any examples appreciated...
Re: Launching the system mail reader [message #453935 is a reply to message #453925] Thu, 14 April 2005 09:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.j.nilsson.sverige.nu

This is perhaps not the best solution, but I placed an e-mail (as a a
msg-file) in the current directory of my application and then executed
the default mail-program and added the e-mail as a parameter. Like this:

final Program program = Program.findProgram (".msg");
if (program != null) {
program.execute("path to pre-formatted e-mail");
}

In windows you can probably do something like:

Runtime.getRuntime().exec("rundll32.exe url.dll,FileProtocolHandler
mailto:<adress>?subject=<subject>&body=<body>");

which seems nicer to me, but is of course limited to Window.


regards,
martin
Re: Launching the system mail reader [message #453936 is a reply to message #453935] Thu, 14 April 2005 09:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.j.nilsson.sverige.nu

An added note:
I'm sure you would be able to put the .msg-file inside of your jar-archive
and get it using a .getResourceAsStream() if you wanted to hide it from
the user.


regards,
martin
Re: Launching the system mail reader [message #453951 is a reply to message #453935] Thu, 14 April 2005 17:52 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">The problem with the msg file solution is that not
all platforms have .msg files assigned to the mail client.  Also, on
Fedora Core 3 - and I assume other Gnome platforms - the Program class
doesn't seem to be able to pull anything up at all.  In other words,
using Program is a Windows and Mac only solution anyway.<br>
<br>
Daniel<br>
</font><br>
Martin J Nilsson wrote:
<blockquote cite="mid1d20ab23139e1c26e6dd6972e94d4ff1$1@www.eclipse.org"
type="cite"><br>
This is perhaps not the best solution, but I placed an e-mail (as a a
msg-file) in the current directory of my application and then executed
the default mail-program and added the e-mail as a parameter. Like
this:
<br>
<br>
  final Program program = Program.findProgram (".msg");
<br>
  if (program != null)  {
<br>
     program.execute("path to pre-formatted e-mail");
<br>
  }
<br>
<br>
In windows you can probably do something like:
<br>
<br>
Runtime.getRuntime().exec("rundll32.exe url.dll,FileProtocolHandler
mailto:&lt;adress&gt;?subject=&lt;subject&gt ;&amp;body=&lt;body&gt; ");
<br>
<br>
which seems nicer to me, but is of course limited to Window.
<br>
<br>
<br>
regards,
<br>
   martin
<br>
<br>
</blockquote>
</body>
</html>
Re: Launching the system mail reader [message #453965 is a reply to message #453951] Thu, 14 April 2005 23:09 Go to previous messageGo to next message
Mark McLaren is currently offline Mark McLarenFriend
Messages: 45
Registered: July 2009
Member
Daniel / Martin - thanks for the response (wasn't aware of the rundll
option). Looks like I'll need a bit of a hack.
Re: Launching the system mail reader [message #453969 is a reply to message #453951] Fri, 15 April 2005 08:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.j.nilsson.sverige.nu

Daniel Spiewak wrote:
> Also, on Fedora Core 3 - and I assume other Gnome platforms -
> the Program class> doesn't seem to be able to pull anything up
> at all. In other words, using Program is a Windows and Mac
> only solution anyway.

Didn't know that, thank you for enlightning me. I'm right in assuming that
this is a bug and that the Program Class should be able to work with all
OSes? Found these

https://bugs.eclipse.org/bugs/show_bug.cgi?id=79268
https://bugs.eclipse.org/bugs/show_bug.cgi?id=78910
https://bugs.eclipse.org/bugs/show_bug.cgi?id=79681

which seems to relate to the same problem. Hopefully this will be fixed in
the somewhat near future then.

What is the best way to find the user's email-client then? Any ideas?


kind regards,
martin
Re: Launching the system mail reader [message #454083 is a reply to message #453969] Fri, 15 April 2005 19:57 Go to previous message
Benjamin Pasero is currently offline Benjamin PaseroFriend
Messages: 337
Registered: July 2009
Senior Member
Well, when I want to work with the system default Mail Client, I am just
opening a
"mailto:abc@xyz.com" using the System default Browser. This might not be
the best
solution, but afaik it is working in most cases.

It is also possible to pass Subject, CC, BC and Mail Body into the Mail, see
http://en.selfhtml.org/html/verweise/email.htm

Ben

> Daniel Spiewak wrote:
>
>> Also, on Fedora Core 3 - and I assume other Gnome platforms - the
>> Program class> doesn't seem to be able to pull anything up at all.
>> In other words, using Program is a Windows and Mac only solution anyway.
>
>
> Didn't know that, thank you for enlightning me. I'm right in assuming
> that this is a bug and that the Program Class should be able to work
> with all OSes? Found these
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=79268
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=78910
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=79681
>
> which seems to relate to the same problem. Hopefully this will be
> fixed in the somewhat near future then.
>
> What is the best way to find the user's email-client then? Any ideas?
>
>
> kind regards,
> martin
>
Previous Topic:Scrolled and only one scrollbar
Next Topic:scrolling behaviour of scrolledcomposite within scrolledcomposite
Goto Forum:
  


Current Time: Thu Mar 04 10:36:08 GMT 2021

Powered by FUDForum. Page generated in 0.01995 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top