views:

27

answers:

2

For example, when you click a link in your web browser, it automatically opens default e-mail client installed on your PC and fills that e-mail address in. I need to perform similar operation, but with file attachment. It will look like "Send file with default e-mail client" option in the software interface.

Is there any API available for that?

+2  A: 

The functionality you are talking about uses the mailto: URL scheme, described in this RFC.

This has no provisions for attachments, so the answer is that, no there is no such API.

You can create your own webform and send email from the server side - this will give you all the control you need over email messages.

Oded
+1  A: 

An API I dont't known. For a simple solution to start the email-client with an address you can use:

System.Diagnostics.Process.Start("mailto:"+emailAddress);

But its only for simple single emails and the limitations are obvious. Make sure to catch the exceptions that could be thrown.

Update I Have not seen the attachment requirement. Can not help in this case but anyhow here sample-code if you have outlook and the interops installed. Maybe it helps you:

 Microsoft.Office.Interop.Outlook.Application app = 
         new Microsoft.Office.Interop.Outlook.Application();
 Microsoft.Office.Interop.Outlook.MailItem mailItem=
         app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);         
 mailItem.Attachments.Add(filePath);
 // ....
HCL