0

I have a similar problem to this question, but could not find any useful information in the answers.

I'm trying to send an email to a recipient with a display name Lastname, firstname using the Quoted-Printable encoding. The exact header, as seen in the source of the received email, is:

To: =?UTF-8?Q?"Lastname,=20firstname"?= <email@example.com>

However, Outlook displays it like this:

Outlook recipient display

Effectively interpreting the comma as a separator between recipients, even though it's enclosed in a Quoted-Printable encoding.

When there is no comma, the header is properly interpreted.

Am I doing something wrong, or is it impossible to use commas in a display-name?

Note: I'm currently using Amazon SES and the ZF2 Zend\Mail component, but the tools should not matter, I'm only interested in the correct header format and will adjust my tools or code accordingly.

Community
  • 1
  • 1
BenMorel
  • 34,448
  • 50
  • 182
  • 322

1 Answers1

1

What you are seeing is not correct behavior as far as I can tell, but the workaround should be obvious: QP-encode the comma. The double quotes are redundant and should be omitted:

From: =?UTF-8?q?Lastname=2C_Firstname?= <email@example.com>

(As such, it is obviously insane to put the last name first; but e.g. Outlook connected to Active Directory seems to insist on this silly anti-convention.)

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • Indeed, it looks like a bug in this library. That makes me notice that PHP's [quoted_printable_encode()](http://www.php.net/manual/en/function.quoted-printable-encode.php) does not encode commas or spaces, either. Anyway, I think I will switch to base64 encoding and live happy! – BenMorel Apr 20 '14 at 21:34
  • QP by itself does not mandate this; the [RFC2047](http://www.ietf.org/rfc/rfc2047.txt) encoding has a few additional requirements of its own. – tripleee Apr 21 '14 at 06:05