aspNetEmail

EmailMessage Constructor (String, String, String, String, String, Boolean)

Create a new mail message and set the default relay Mail Server, the From email address, and the Email To address..

public EmailMessage(
   string MailServer,
   string FromAddress,
   string RecipientAddress,
   string Subject,
   string Body,
   bool SendMail
);

Parameters

MailServer
The Mailserver to relay through, either by IP or by DNS name. For example: 127.0.0.1 or mail.mycompany.com
FromAddress
The 'From' address of the email, for example: FromMe@myCompany.com
RecipientAddress
The person that will be receiving the email.
Subject
The subject of the email.
Body
The Body of the email.
SendMail
True or false, if you want to immediately send the email, without setting any more properties.

Example

[C#]
		EmailMessage msg = new  EmailMessage("Mail1.MyCompany.com", "me@MyCompany.com", "you@YourCompany.com", "Daily Newsletter", "Here is our daily newsletter.....", false);
		if ( msg.Send() )
		{
			Console.WriteLine( "Message Sent!");
		}
		else
		{
			Console.WriteLine( msg.LastException().Message );
		}
		
[Visual Basic]
		Dim msg As New EmailMessage("Mail1.MyCompany.com", "me@MyCompany.com", "you@YourCompany.com", "Daily Newsletter", "Here is our daily newsletter.....", False)
		If (msg.Send()) Then
		    Console.WriteLine("Message Sent!")
		Else
		    Console.WriteLine(msg.LastException().Message)
		End If
		

See Also

EmailMessage Class | aspNetEmail Namespace | EmailMessage Constructor Overload List