I'm using MailMessage
class and then sent mail to many recipients. My code is here.
MailMessage msg = new MailMessage();
SmtpClient client = new SmtpClient("smtp.mysite.com");
client.EnableSsl = false;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("myusername@mysite.com", "mypassword");
forea(User u in users)
{
msg.To.Add(u.Email);
}
client.Send(msg);
This work successfully.
But problem is all email shown on the recipient computer. TO: user1.fds.com;email2.fdsa.com;email3.fdsa.com;...
etc.
I need to show only current user email. How to do it?
Maybe i will do it like this
forea(User u in users)
{
msg.To.Clear();
msg.To.Add(u.Email);
client.Send(msg);
}
But it is too slowly.