diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-11-04 21:41:40 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-11-04 21:41:40 +0000 |
commit | 9d21b18670218f1932c7b68b0a64f9b2f4ab94ff (patch) | |
tree | bae1ca5caf540f3ffab970f05540de90bd9a450d | |
parent | 4f74255cfef37a2f26bb4aafd780c50d8f90b724 (diff) | |
download | portage-9d21b18670218f1932c7b68b0a64f9b2f4ab94ff.tar.gz portage-9d21b18670218f1932c7b68b0a64f9b2f4ab94ff.tar.bz2 portage-9d21b18670218f1932c7b68b0a64f9b2f4ab94ff.zip |
Bug #291331 - Make send_mail() encode the unicode message as bytes before
passing it to smtplib.SMTP.sendmail(), in order to avoid a UnicodeEncodeError
which SMTP.send() tries to encode the message a plain ascii.
svn path=/main/trunk/; revision=14776
-rw-r--r-- | pym/portage/mail.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pym/portage/mail.py b/pym/portage/mail.py index 040cd1136..9a69f9604 100644 --- a/pym/portage/mail.py +++ b/pym/portage/mail.py @@ -127,7 +127,9 @@ def send_mail(mysettings, message): myconn = smtplib.SMTP(mymailhost, mymailport) if mymailuser != "" and mymailpasswd != "": myconn.login(mymailuser, mymailpasswd) - myconn.sendmail(myfrom, myrecipient, message.as_string()) + msg = _unicode_encode(message.as_string(), + encoding=_encodings['content'], errors='backslashreplace') + myconn.sendmail(myfrom, myrecipient, msg) myconn.quit() except smtplib.SMTPException as e: raise portage.exception.PortageException(_("!!! An error occured while trying to send logmail:\n")+str(e)) |