How to format an email 'From' header that contains a comma

Dalin picture Dalin · Mar 21, 2013 · Viewed 7.3k times · Source

The standard way to format the 'From' email header is

From: John Doe <[email protected]>

But what to do if there's a comma in the name?

From: John Doe, chief bottle washer <[email protected]>

If I do that, my MTA automatically converts this into:

From: [email protected], [email protected], chief bottle washer <[email protected]>

My first guess is to use double-quotes around the full name, but I can't find any official documentation confirming this and I'd like my emails to be readable by all email clients.

Answer

Dalin picture Dalin · Mar 25, 2013

To elaborate on the answer by @Fls'Zen, yes the proper method is to enclose the name in double-quotes.

From a practical point of view there's no harm in wrapping all names in double-quotes, just be sure to escape a double-quote if it appears in the display name \" (or just replace with a single-quote). But if you want to be completely by the spec, you shouldn't use the double quotes if you don't have to.

For all the dense details, E-mail header fields are defined by RFC 5322. The relevant section for multiple originators in the From header is 3.6.2, and the relevant sections for quoting delimiters is 3.2.1 and 3.2.4.