Multiple address in MailAddress constructor

You cannot use the MailAddress constructor for specifying multiple receipts, but you can to use the MailMessage object as showed below. Using the MailMessage (not MailAddress) constructor: var msg = new MailMessage(“[email protected]”, “[email protected], [email protected]”); another way is: MailMessage mail = new MailMessage(); mail.To.Add(“[email protected],[email protected],[email protected]”); another way is: MailMessage msg = new MailMessage(); msg.To.Add(“[email protected]”); msg.To.Add(“[email protected]”); msg.To.Add(“[email protected]”); msg.To.Add(“[email protected]”);

“Unable to read data from the transport connection: net_io_connectionclosed.” – Windows Vista Business and SMTP

There are several things that can cause this problem, and here are some of the things that I’ve found. Questions: You mention “Exchange” — Is this an exchange server? Does the host require authentication (maybe you need to add authentication to the client)? What I would try doing first is assigning the host to the … Read more

.Net System.Mail.Message adding multiple “To” addresses

I wasn’t able to replicate your bug: var message = new MailMessage(); message.To.Add(“user@example.com”); message.To.Add(“user2@example.com”); message.From = new MailAddress(“test@example.com”); message.Subject = “Test”; message.Body = “Test”; var client = new SmtpClient(“localhost”, 25); client.Send(message); Dumping the contents of the To: MailAddressCollection: MailAddressCollection (2 items) DisplayName User Host Address user example.com user@example.com user2 example.com user2@example.com And the resulting e-mail … Read more

Send SMTP email using System.Net.Mail via Exchange Online (Office 365)

Fixed a few typos in the working code above: MailMessage msg = new MailMessage(); msg.To.Add(new MailAddress(“someone@somedomain.com”, “SomeOne”)); msg.From = new MailAddress(“you@yourdomain.com”, “You”); msg.Subject = “This is a Test Mail”; msg.Body = “This is a test message using Exchange OnLine”; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential(“your user … Read more

MailMessage, difference between Sender and From properties

Excerpt from the wiki on email: Header fields: The message header should include at least the following fields: From: The e-mail address, and optionally the name of the author(s). In many e-mail clients not changeable except through changing account settings. Also note that the “From:” field does not have to be the real sender of … Read more