SmtpMail.Send Method (MailMessage)
.NET Framework 2.0
Sends an e-mail message using arguments supplied in the properties of the MailMessage class. Recommended alternative: System.Net.Mail.
Namespace: System.Web.Mail
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
The following example shows how to use MailMessage to send an e-mail message using SmtpMail.
MailMessage myMail = new MailMessage();
myMail.set_From("from@microsoft.com");
myMail.set_To("to@microsoft.com");
myMail.set_Subject("UtilMailMessage001");
myMail.set_Priority(MailPriority.Low);
myMail.set_BodyFormat(MailFormat.Html);
myMail.set_Body("<html><body>UtilMailMessage001 - success</body></html>");
MailAttachment myAttachment = new MailAttachment("c:\\attach\\attach1."
+ "txt",MailEncoding.Base64);
myMail.get_Attachments().Add(myAttachment);
SmtpMail.set_SmtpServer("MyMailServer");
SmtpMail.Send(myMail);
Community Additions
ADD
Show: