.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 “sender@server.com” 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("sender@server.com");
message.To.Add(new MailAddress("recipient1@server.com"));
message.CC.Add(new MailAddress("copy@server.com"));
message.Subject = "This is the subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient();
client.Send(message);
For Asp.Net System.Net.Mail reads SMTP configuration data from web.config.Here is example
<system.net> <mailSettings>
<smtp from="test@server.com">
<network host="smtpserver" port="25" userName="username" password="pass" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>