This is a very simple method of sending SMTP mail using C#. Some points that are of intereset are the "To", "CC" and "BCC" collections, that allow multiple addresses to be added.
MailMessage mailMessage = new MailMessage();
SmtpClient smtpClient = new SmtpClient();
mailMessage.From = new MailAddress("from@mymail.com");
mailMessage.To.Add(new MailAddress("to@mymail.com"));
mailMessage.CC.Add(new MailAddress("cc1@mymail.com"));
mailMessage.Bcc.Add(new MailAddress("bcc1@mymail.com"));
mailMessage.Subject = "My SMTP Mail";
mailMessage.Body = "This is the body of the mail";
//smtpClient.Host = "127.0.0.1";
//smtpClient.Port = 25;
//smtpClient.UseDefaultCredentials = false;
smtpClient.Send(mailMessage);
Also, you will noticed the programmatic configuration if the SMTP Client object has been commented out. You can configure this in the application configuration file, by adding a section like the following:
<system.net>
<mailSettings>
<smtp from="from@mymail.com">
<network host="127.0.0.1" port="25" defaultCredentials="false" />
</smtp>
</mailSettings>
</system.net>
You can also configure parameters such as the username and password that the SMTP client should use when loggin on to the server. These are attributes of the <network> node.