PEAR MIME-mail with non-ASCII characters in recipient field

Creating headers using the Mail_mime::headers() function when there are non-ASCII characters¬†in the To¬†field (the From and Subject fields don’t suffer from this problem) and then trying to send the message results in a “Validation failed for: <recipient>” error.

Overcome this by encoding the recipient field separately using the Mail_mime::encodeHeader() function before passing it to Mail_mime::headers().