11
In the code snippet below, I'm getting a FormatException on this.Recipients. More specifically, the message is
An invalid character was found in the mail header: ';'".
Recipients is a string of three email addresses separated by semicolons (;). The list of recipients is read from an app.config file and the data is making it into the Recipients variable successfully.
As far as I know, multiple recipients should be separated by a semicolon. So why am I getting this error, and how can I resolve it?
This is the relevant function:
public bool Send()
{
MailMessage mailMsg = new MailMessage(this.Sender, this.Recipients, this.Subject, this.Message);
SmtpClient smtpServer = new SmtpClient(SMTP);
smtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
}
This resource says I can use a semicolon as a delimiter.