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 Just removed that and voila! its working. Don’t know why it’s working in console application but not in sharepoint 🙁 If this does not work in SharePoint then please add each address separately onto MailMessage object like below; }