Skip to content

possible issue with decoding utf-8 headers #7

Closed
ericrasmussen opened this Issue Apr 24, 2012 · 2 comments

4 participants

@ericrasmussen

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, "e@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):

     fromaddr = message['X-Actually-From']
   + from email.header import decode_header
   + fromaddr = decode_header(fromaddr)[0][0]

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.

Thanks!

@hellp
hellp commented Apr 25, 2012

Having the same issue.

@hellp hellp added a commit to hellp/repoze.sendmail that referenced this issue Apr 25, 2012
@hellp hellp Workaround for github issue #7. 6264a15
@rpatterson

Starting work now.

@rpatterson rpatterson added a commit to rpatterson/repoze.sendmail that referenced this issue Apr 30, 2012
@rpatterson rpatterson Fix issue #7, handling of to/from addresses with non-ascii characters
when using queued mail delivery.
b444120
@mcdonc mcdonc closed this May 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.