Knowledge Essentials - 3Essentials Hosting

SMTP-AUTH in's System.Net.Mail

Article ID: 1930

 Back to Search

Sending Email with System.Net.Mail using SMTP-auth

For 1.0 and the older System.Web.Mail see:

For ASP.NET 2.0 includes much richer Email API support within the System.Net.Mail code namespace.  Here is a simple snippet of how to send an email message from “” to multiple email recipients (note that the To a CC properties are collections and so can handle multiple address targets):

MailMessage message = new MailMessage();

message.From = new MailAddress("");
message.To.Add(new MailAddress(""));
message.To.Add(new MailAddress(""));
message.To.Add(new MailAddress(""));
message.CC.Add(new MailAddress(""));
message.Subject = "This is my subject";
message.Body = "This is the body of my email";
SmtpClient client = new SmtpClient();

System.Net.Mail reads SMTP configuration data out of the standard .NET configuration system (so for ASP.NET applications you’d configure this in your application’s web.config file).  Here is an example of how to configure it:
      <smtp from="">
        <network host="" port="25" userName="" password="mypassword" />


  • Of course, anywhere you ssee "" or "", replace the with your actual domain that's hosted with 3Essentials. 
  • The  host=""  parameter can also be set as  host="localhost"
Downloads Associated With This Article
No downloads are currently associated with this article.