snoyberg/mime-mail — Issue #5: Incorrectly encoded 'to' header
Author: hesselink
Created: 2011-11-01 23:20:38+00:00
State: open

We've been running into issues where the 'to' header is incorrectly encoded. We create 'to' fields of the form 'Name ', but when Name contains 'special' characters, the address is transformed into something like this:

=?utf-8?Q?Danilo_H=C3=A4rtzer_?=: malformed address: ?= may not follow =?utf-8?Q?Danilo_H=C3=A4rtzer_

Reading the spec (RFC 2407), this should be turned into:

=?utf-8?Q?Danilo_H=C3=A4rtzer?=

So the email part should not be inside the =?...?= block. What would be a good way to fix this? Currently, there is no data type for mail messages separating the 'name' from the 'email address'. Introducing something like that seems like a good solution to me.