System.Web.Mail.MailMessage Class

Provides properties and methods for constructing an e-mail message. Recommended alternative: System.Net.Mail.

See Also: MailMessage Members

Syntax

[System.Obsolete("The recommended alternative is System.Net.Mail.MailMessage.")]
public class MailMessage

Remarks

C# Example

using System;
using System.Web.Mail;

class SmtpExample
{
	public static void Main(string[] args)
	{

		// Construct message		
		MailMessage msg= new MailMessage();
		msg.From = "mono@example.com";
		msg.To = "howard.cole@example.com";
		msg.Subject = "An example email";
		msg.Body = "<strong>This<strong> is an example of an HTML email.<p><pre>OK!</pre></p>"
		msg.BodyFormat = MailFormat.Html;

		// Send via SMTP server		
		SmtpMail.SmtpServer="smtp.example.com";
		SmtpMail.Send(msg);
		
	}
}
  

Requirements

Namespace: System.Web.Mail
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0