0

Possible Duplicate:
How to send email using default email client?

How can I create SendTo mail recipient feature in C# Windows Form Application? Something like this:

Send to Mail recipient

I need to open the Default Email client in the system and users allowed to enter to address, subject, mail body etc.

I found some code in C++ but I am looking for managed or WIN32 API code.

Community
  • 1
  • 1
Anuraj
  • 18,859
  • 7
  • 53
  • 79
  • @Hans Passant I require this feature in Windows Form application. Its programming related. – Anuraj Aug 19 '11 at 18:27
  • Yes it will open the default mail client. But its not attaching the file :( – Anuraj Aug 19 '11 at 18:35
  • 1
    Here's an example: http://stackoverflow.com/questions/809538/how-to-send-email-using-default-email-client Cheers – Luc Morin Aug 19 '11 at 18:35
  • Why in windows forms would want bring up another application to send a mail? – Paul C Aug 19 '11 at 18:36
  • I need to incorporate a feature like I want to send my applications output file as email attachment. – Anuraj Aug 19 '11 at 18:38
  • I got the answer : http://www.codeproject.com/KB/IP/SendFileToNET.aspx thanks to :@mrlucmorin :) – Anuraj Aug 19 '11 at 18:46
  • Well, that was completely unguessable from the question. Why on Earth didn't you mention that? Use the MailMessage.Attachments property. The capability to specify attachments with external mailers that accept the mailto protocol has been removed a long time ago due to widespread abuse. – Hans Passant Aug 19 '11 at 18:47

2 Answers2

1

Try SmtpClient if you know all details of the message and just want to send it.

If you need to invoke the mail client, you can use Process.Start and pass it a mailto: link. There are some good examples of crafting mailto links on the web, I found this one.

PaulF
  • 1,133
  • 8
  • 14
1

I think this is what you may be looking for.

  1. Visit http://msdn.microsoft.com/en-us/library/aa767737(VS.85).aspx and read up on the mailto syntax.

  2. Visit http://weblogs.asp.net/jgalloway/archive/2007/02/24/sending-files-via-the-default-e-mail-client.aspx and see that there is an example on using the mailto format to load the default email client on a machine using System.Diagnostics.Process.Start

Dekryptid
  • 1,062
  • 1
  • 9
  • 21