Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
possible issue with decoding utf-8 headers #7
I'm using pyramid_mailer's Mailer class to send a Message. If I use the Mailer's send() method it works. If I use the send_to_queue() method instead, then the qp script that attempts to send the email raises an SMTPRecipientsRefused exception ("Domain name required for sender address").
From what I can tell, repoze.sendmail is encoding the X-Actually-From header (the recipient address, say, "email@example.com") as utf-8, then storing the message in the maildir. When it later parses the message, it doesn't decode the header. Instead it sets the string "=?utf-8?q?e=40example=2Ecom?=" as the sender, which raises the exception.
As a temporary workaround I added two lines to the QueueProcessor's _parseMessage method (in repoze.sendmail.queue):
I'm not submitting it as a patch because I don't think it's the best approach, but I wanted you to see the change I had to make to get it working for me on Python 2.7. Please let me know if there's something I should be doing different or if this is a legitimate issue.