//simple emailMailMessage mail = new MailMessage();mail.To = "me@mycompany.com";mail.From = "you@yourcompany.com";mail.Subject = "this is a test email.";mail.Body = "this is my test email body";SmtpMail.SmtpServer = "localhost"; //your real server goes hereSmtpMail.Send( mail );
//simple Html emailMailMessage mail = new MailMessage();mail.To = "me@mycompany.com";mail.From = "you@yourcompany.com";mail.Subject = "this is a test email.";mail.BodyFormat = MailFormat.Html;mail.Body = "this is my test email body.
this part is in bold";SmtpMail.SmtpServer = "localhost"; //your real server goes hereSmtpMail.Send( mail );
//email with attachments
MailMessage mail = new MailMessage();mail.To = "me@mycompany.com";mail.From = "you@yourcompany.com";mail.Subject = "this is a test email.";mail.Body = "this is my test email body.";MailAttachment attachment = new MailAttachment( Server.MapPath( "test.txt" ) ); //create the attachmentmail.Attachments.Add( attachment ); //add the attachmentSmtpMail.SmtpServer = "localhost"; //your real server goes hereSmtpMail.Send( mail );
//change the TO address to a friendly namemail.From = "\"John Smith\" ";//multiple recipientsmail.To = "me@mycompany.com;him@hiscompany.com;her@hercompany.com";
http://www.systemwebmail.com/faq/1.aspx
http://www.systemwebmail.com/faq/1.aspx
http://www.systemwebmail.com/faq/1.aspx
http://www.systemwebmail.com/faq/1.aspx