tags:

views:

523

answers:

2

Hi everyone, I need to create a java code that will open an email client (Outlook, outlook express , etc) and automatically attach a file in it. I tried using mailto but it only opens the mail client and do not attach the file. Help please.

thanks a lot.

A: 

It depends on particular email clients, but &attachment parameter should work for at least some versions of Outlook.

http://msdn.microsoft.com/en-us/library/aa767737%28VS.85%29.aspx

ykaganovich
+1  A: 

If this is a client application you can take a look at the java.awt.Desktop class.

From the javadoc...

Launches the mail composing window of the user default mail client, filling the message fields specified by a mailto: URI.

A mailto: URI can specify message fields including "to", "cc", "subject", "body", etc. See The mailto URL scheme (RFC 2368) for the mailto: URI specification details.

This doesn't allow you to attach a file, but it will open up the user's mail client.

This link may be helpful... Using the Desktop API in Java SE 6

delux247