Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive

Recently the following error was reported regularly in the Sitecore log-file:

8356 14:07:32 WARN  An invalid character was found in the mail header: ','.
Exception: System.FormatException
Message: An invalid character was found in the mail header: ','.
Source: System
   at System.Net.Mail.DotAtomReader.ReadReverse(String data, Int32 index)
   at System.Net.Mail.MailAddressParser.ParseAddress(String data, Boolean expectMultipleAddresses, Int32& index)
   at System.Net.Mail.MailAddressParser.ParseMultipleAddresses(String data)
   at System.Net.Mail.MailAddressCollection.ParseValue(String addresses)
   at Sitecore.Form.Core.Pipelines.ProcessMessage.ProcessMessage.GetMail(ProcessMessageArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Form.Core.Submit.SubmitActionManager.ExecuteSaving(ID formID, ControlResult">"> list, ActionDefinition[ actions, Boolean simpleAdapt, ID sessionID)

8356 14:07:32 WARN  The 'Send Email Messageid={D4502A11-9417-4479-9F2A-485F45D2E2D0}' save action failed: An invalid character was found in the mail header: ','.
8356 14:07:32 WARN  Web Forms for Marketers: an exception: An invalid character was found in the mail header: ','. has occured while trying to execute an action.

Initially it was not clear what was causing this problem. The error message is showing that it is raised by WFM (WebForms for Marketers), but what is causing it?

In the end we discovered that it is caused by an incorrect value of the field "BCC" of the "Send Email Message" action of a form. The value was "email1@evident.nl;email2@evident.nl;". Notice the semicolon at the end of the string. After removing the trailing semicolon the error was gone. So, if you ever see this error, make sure that you check the fields "TO", "CC" and "BCC" of the "Send Email Message" and remove all trailing semicolons.

Note: This information is based on Sitecore v7.2 and WFM v2.4. It was not tested in other versions of Sitecore and WFM.

 © Evident Interactive BV