aspNetEmail

EmailMessage Constructor (String, String, String)

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
);

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.

Example

[C#]
		EmailMessage msg = new EmailMessage( "Mail1.MyCompany.com","me@MyCompany.com","you@YourCompany.com" );
		msg.Subject = "Daily Newsletter";
		msg.Body = "Here is our daily newsletter.....";
		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")
		msg.Subject = "Daily Newsletter"
		msg.Body = "Here is our daily newsletter....."
		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