[Answering follow-up questions from the comments to Solution 1]
Andrew Chambers wrote:
Hi SA, I would like to insert the body of my webpage into the email clients body. Outlook is the email client. Are there any classes I should look at?
Andrew,
From your questions, I feel you misunderstand e-mail operation or maybe roles of server and client parts in Web application as well as HTTP.
First part of your recent question assume that you want to sent e-mail from your Web application; and you are using the class
MailMessage
which works on the server side. It has nothing to do with your Outlook e-mail client. When you send e-mail, you don't know the e-mail client of the receiver.
What you do in your Web application is: you generate some Web form in your Web application; it can be a simple static HTML file. It should have the "POST" method of HTTP request. Your server side should get the post data and make e-mail out of it. In other cases, you should use the data available on your server side (such as HTML page you want to send), e-mail address and other headers.
The e-mail message is nothing more but a single block of text data. Even if you have ZIP files "attached" or images, or anything else, you always encode this data in a text format (using base64, etc.). This is all done using
multipart MIME messages. All parts are combined into just one single text. If you have any *.EML files — each such file is an exact raw packet send via e-mail.
Now, you need some
message transfer agent which is available on you server side. Usually, this is a separate server on a separate (or the same) host with separate (or the same) URI or domain name implementing some mail protocol. Most typically, this is a SMTP server, but it can be something else. You need to check up with your Web hosting provider or setup appropriate server by yourself, if you self-host your HTTP and other servers.
It has nothing to do with you Outlook or any other clients. This is something you need to understand. Please read this:
http://en.wikipedia.org/wiki/Email[
^],
http://en.wikipedia.org/wiki/Email_client[
^],
http://en.wikipedia.org/wiki/Mail_transfer_agent[
^],
http://en.wikipedia.org/wiki/SMTP[
^].
Better now?
Now, let's see how multipart messages could be created. Basically, creation of such messages in nothing more but composing some text following e-mail standard, specified in a number of IETF RFC documents.
Please see:
http://en.wikipedia.org/wiki/Request_for_Comments[
^].
MIME RFCs are listed here:
http://en.wikipedia.org/wiki/MIME[
^].
See also:
http://www.ietf.org/rfc/rfc1867.txt[
^].
See also:
http://www.iana.org/assignments/message-headers/perm-headers.html[
^].
Please find a code sample using .NET
System.Net.Mail
:
http://www.systemnetmail.com/faq/3.1.3.aspx[
^].
Warning! If you ever need to form a mail based on user's submission: be extra careful. It's way too easy to exploit your HTTP host to turn it into a zombie sending spam or something else. Please see my recent post:
unable to send mail , it showing the error in below code .[
^].
—SA