tags:

views:

185

answers:

2

My website creates an email from an HTML template using MailDefinition and ending up with a System.Net.Mail.MailMessage object.

Usually, I just call the Net.Mail.SmtpClient.Send method and the email is sent.

Now I need to be able to open the created email in the clients default mail program and then they click their email programs send button to send it.

Has anyone got an ideas on how to proceed?

This is in VS2005.

+1  A: 

You'll want to use a mailto: link -- which means, if this is the only method your users will have to send emails, that your code that uses SmtpClient will no longer be used.

Unfortunately, unless this is an intranet-only application, you don't have too many other options, as browsers will not give you enough permissions to execute code against that machine's default email client.

Jeremy Frey
Unfortunatley I think my "body" will be too big for the mailto. I minor workaround is just to pop it up in some kind of window in like an HTML edit control or something like that! Thanks for the reply.
Dominic
A: 

The two ways I can think of are:

  • use a < a href="mailto:[email address here">-Element. But you can't set anything except the recipient this way
  • You could send a .eml-File with content-disposition "attachment", that should be opened by the user's default mail program

Edit: I just saw Jeremy's link and found out that you actually can supply body/subject/cc with a mailto-link. You can't supply attachments, though (I think)

Niki