Hi,
I have a string in which various email are available and are seperated by semicolon. I am trying to add the users one by one in the "To" field. I am getting error as "system.formatexception the specified string is not in the form required for an e-mail address".
Below is the code:
string strToMailId = "abc@gmail.com;bhs@gmail.com";
MailMessage objMail = new MailMessage();
char[] separator = new char[] { ';' };
string[] strSemiColonSeperatedToMailId = null;
strSemiColonSeperatedToMailId = strToMailId.Split(separator);
foreach (string strToUserMailId in strSemiColonSeperatedToMailId)
{
//Assign the To address
objMail.To.Add(strToUserMailId);
}
I cannot change the seperator in the strToMailId to comma, as the data is coming from another page.
How to fix this?
Thanks
...
Go to the complete details ...