Merge lp:~kaaloo/bzr-email-notifier/unicode-fix into lp:bzr-email-notifier

Proposed by Luis Arias
Status: Needs review
Proposed branch: lp:~kaaloo/bzr-email-notifier/unicode-fix
Merge into: lp:bzr-email-notifier
Diff against target: 28 lines (+3/-3)
1 file modified
configuration.py (+3/-3)
To merge this branch: bzr merge lp:~kaaloo/bzr-email-notifier/unicode-fix
Reviewer Review Type Date Requested Status
Nicholas Allen Pending
Review via email: mp+89968@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

115. By Luis Arias <email address hidden>

Arguments to SMTP.sendmail need to conform to RFC822. Make sure they are ascii encoded.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configuration.py'
--- configuration.py 2011-06-21 19:18:49 +0000
+++ configuration.py 2012-01-24 18:22:38 +0000
@@ -98,13 +98,13 @@
98 address in the From header, and to_emails a list of all the98 address in the From header, and to_emails a list of all the
99 addresses in the To, Cc, and Bcc headers.99 addresses in the To, Cc, and Bcc headers.
100 """100 """
101 from_email = Utils.parseaddr(message.get('From', None))[1]101 from_email = Utils.parseaddr(message.get('From', None))[1].encode('ascii', 'xmlcharrefreplace')
102 to_full_addresses = []102 to_full_addresses = []
103 for header in ['To', 'Cc', 'Bcc']:103 for header in ['To', 'Cc', 'Bcc']:
104 value = message.get(header, None)104 value = message.get(header, None)
105 if value:105 if value:
106 to_full_addresses.append(value)106 to_full_addresses.append(value)
107 to_emails = [pair[1] for pair in107 to_emails = [pair[1].encode('ascii', 'xmlcharrefreplace') for pair in
108 Utils.getaddresses(to_full_addresses)]108 Utils.getaddresses(to_full_addresses)]
109109
110 return from_email, to_emails110 return from_email, to_emails
@@ -120,7 +120,7 @@
120 try:120 try:
121 self._connect()121 self._connect()
122 self._connection.sendmail(from_email, to_emails,122 self._connection.sendmail(from_email, to_emails,
123 message.as_string())123 message.as_string().encode('ascii', 'xmlcharrefreplace'))
124 except (socket.error, smtplib.SMTPException), e:124 except (socket.error, smtplib.SMTPException), e:
125 self.disconnect()125 self.disconnect()
126 raise SendEmailError(e)126 raise SendEmailError(e)

Subscribers

People subscribed via source and target branches

to all changes: