send email with C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to do the following with C# in my asp.net app:

Open the default email client of the user (just like a mailto: link would).
Supply the subject line and put some HTML (including an image) into the
body of the email.

Any help would be greatly appreciated.
 
The ASP.NET application is server-side, and the client's email is
client-side. The server does not have the ability to open applications on
the client.

The web application can send an email using the System.Web.Mail.MailMessage
class, but this would happen transparent to the user and would not involve
email on the client's computer.

You could use html to perform most of what you are describing.
<a href="mailto:[email protected]&subject=This is the subject&body=This is the
body">Click Here.</a>

Hope that helps.
 
If this is the case then what are these people talking about?

HEADING:

"The following is how to launch the systems default email client with a new
message while setting the to,
subject, and message body."

http://www.loresoft.com/Snippets/CSharp/50.aspx

I realize that they are creating a mailto link as you suggested but is there
a way to open the clients email app or not? Also, keeping my eye on the
prize, I am looking for a way to set the Content-type of the email so that I
can put some HTML in the body, otherwise, I will just use the mailto: I have
in place. Thank you for you response.
 
They are writing out the same hyperlink I described earlier (passing the
subject and body text) and executing as a server side process. This will
open the server's default mail client on the server, and NOT on the client.
 
You are quite right. So is there any way to open the clients email and
automatically put some HTML in the body of the email using code behind in C#
web app?
 
So is there any way to open the clients email and
automatically put some HTML in the body of the email using code behind in
C#
web app?

no.
"code behind" in a web app runs on the server. if you, in C# code,
programmatically open the default mail program , and your code is running on
the server, that mail program will run on the server, not on the client (web
browser machine).

it may be possible to format a document in .msg format, which outlook
registers itself for, and then download that .msg file to the client via the
browser. In theory this would open up outlook and allow the user to "fill
in" the rest of the message. however, XPSP2 will probably try to block it.
I have never tried this though, so I don't know. I don't know if the .msg
doc format is documented.
 
Back
Top