Parses a RFC2822 formatted message sting into an EmailMessage
The RFC 2822 format is the standard format found in email messages. The text is basically formatted with email headers, a blank line, and then a body.
[C#]
//load an email message from the filesystem
string path = "c:\\temp\\sample.eml";
StreamReader sr = new StreamReader( path );
string contents = sr.ReadToEnd();
sr.Close();
EmailMessage msg = EmailMessage.Parse( contents );
//set the server
msg.Server = "mail.myCompany.com";
//send
msg.Send();
[VB.NET]
'load an email message from the filesystem
Dim path As String = "c:\temp\sample.eml"
Dim sr As New StreamReader(path)
Dim contents As String = sr.ReadToEnd()
sr.Close()
Dim msg As EmailMessage = EmailMessage.Parse(contents)
'set the server
msg.Server = "mail.myCompany.com"
'send
msg.Send()
EmailMessage Class | aspNetEmail Namespace | EmailMessage.Parse Overload List