title: How to open default email client like Ms Outlook, Lotus, thunderbird from java program with attachemnt?
body: <p>Though the question is asked so many times on the forum. I didn't find a solution to it atleast for Java. I googled it but in vain.</p>
  
  <p>My requirement: I have to open the default email client(like MS Outlook, Lotus, Thunderbird) in the users machine which should auto attach the file to the email clinet.
  My problem: I am not able to attach the file. I have tried various method listed down. But its not attaching the file. I am howvere little bit succedded to attach file in Lotus Notes 8.5. But didnt find solutions for outlook and other email clients.</p>
  
  <p>My Approach(es):
  1. Below code works fine with Lotus Notes 8.5 and it does auto aatch the file. But not working in other clients</p>
  
  <pre><code>Desktop fDesktop = Desktop.getDesktop();
  String url = 
  "mailTo:you@xyz.com,me@abc.com" (mailTo:you@xyz.com,me@abc.com%27) + 
  "?subject=" + getEmailSubject() + 
   "&amp;body=" + getEmailBody()+
   "&amp;Attach=C:/temp/blah.txt";
   URI mailTo = new URI(url);
   fDesktop.mail(mailTo);
  </code></pre>
  
  <p>2.Our most of the users are outlooks users. So i want some solution which can work with Outlook (2007 and 2010)
  For Outlook I tried with following. But in Vain. It does opening the client with To, Subject , Body but not attaching the file. Also I am getting "The Command line Argument is not valid. Please verify the Switch". I tried 
  using swicthes also but not sure if I am doing it correct way. </p>
  
  <pre><code>      &lt;a href='mailto:recip@domain.com?subject=Some subjectl&amp;body=Bodytext.&amp;attachment=""C:\temp\blah.txt""'&gt;Click here 1&lt;/a&gt;
  
  
         &lt;a href='c:\program files\microsoft office\office12\outlook.exe' /c ipm.note /m   someone@gmail.com /a 'c:\temp\blah.txt'&gt;Click here 2&lt;/a&gt;
  
         &lt;a  onclick="window.close();" href="mailto:?subject= Report&amp;amp;body=Attach Report%0A as an email attachment%0A%0AFor 2008 April.&amp;amp;&amp;quot;&amp;quot;C:\temp\blah.txt"&gt;Click here 3&lt;/A&gt;
  
         &lt;a  onclick="window.close();" href="mailto:?subject= Report&amp;amp;body=Attach Report%0Aas%20an%20email%20attachment%0A%0AFor%202008%20April%2E&amp;amp;&amp;quot;&amp;quot;C%3A%5Ctempt%5Cblah%2Etxt"&gt;Click here 4&lt;/a&gt;
  </code></pre>
  
  <p>I need experts advice on this. I need it urgently for the project. Any help will be appreciated.</p>