How to deal with: WARN An invalid character was found in the mail header: ‘,’ in Sitecore

If you are using Web Forms for Marketers in Sitecore then you may have an occasion where the email addresses that are being used to send messages to get updated by someone…then all of a sudden you start getting errors…then all of a sudden your phone starts ringing off the hook, right?

So in the Sitecore logs you will see something similar to:

 868 13:12:53 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.ParseDomain(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 System.Net.Mail.Message..ctor(String from, String to)
 at System.Net.Mail.MailMessage..ctor(String from, String to)
 at System.Net.Mail.MailMessage..ctor(String from, String to, String subject, String body)
 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)

Huh? OK, so let’s go look at the Web Form Send Email action in question:

ss1wffm

Nothing looks odd at first…until upon further research: I discovered after some reading about mail headers that the last entry of the recipients (To, CC, BCC) cannot accept a separator delimiter as a character on the end. You’ll also notice in outlook and other email clients that the behavior is the same.

The fix? remove the last character and save/republish your form. Problem solved!

ss2wffm

Hope this helps. Questions are welcome!

Advertisements