MailMessage.To.Add() throwing exception : “An invalid character was found in the mail header: ‘,’.”
Got the culprit: It’s the extra comma(,) at the end of last email address mailMessage.To.Add(“[email protected],[email protected],”); Remove the trailing comma and it will work: mailMessage.To.Add(“[email protected],[email protected]”); If this does not work in SharePoint then please add each address separately onto MailMessage object like below; foreach (var address in StringofEmails.Split(“,”)) { MailMessage.To.Add(new MailAddress(address.Trim(), “”)); }