3

An invalid character was found in the mail header: ';'.

String s="arun@gamil.com,mohan@gmail.com";

MailMessage oMailMessage = new MailMessage();
oMailMessage.To.Add(new MailAddress(s));
oMailMessage.From = new MailAddress(oSmtpSection.From);

I am getting error in oMailMessage.To.Add(new MailAddress(s));

manuell
  • 7,528
  • 5
  • 31
  • 58
Arun Singh
  • 39
  • 1
  • 5
  • 1
    Possible duplicate of http://stackoverflow.com/questions/7498968/how-to-send-email-to-multiple-address-using-system-net-mail – shree.pat18 Dec 16 '13 at 10:23
  • 2
    thanks! I have done and replace oMailMessage.To.Add(new MailAddress(s)); to oMailMessage.To.Add(s); – Arun Singh Dec 17 '13 at 05:04

1 Answers1

0

Here's the code:

MailMessage oMailMessage = new MailMessage();
oMailMessage.Body = ....;
oMailMessage.To.Add("arun@gamil.com");
oMailMessage.To.Add("mohan@gmail.com");

SmtpClient smtp = new SmtpClient();
smtp.Send(oMailMessage);
Rahul Nikate
  • 6,192
  • 5
  • 42
  • 54