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
1=== modified file 'configuration.py'
2--- configuration.py 2011-06-21 19:18:49 +0000
3+++ configuration.py 2012-01-24 18:22:38 +0000
4@@ -98,13 +98,13 @@
5 address in the From header, and to_emails a list of all the
6 addresses in the To, Cc, and Bcc headers.
7 """
8- from_email = Utils.parseaddr(message.get('From', None))[1]
9+ from_email = Utils.parseaddr(message.get('From', None))[1].encode('ascii', 'xmlcharrefreplace')
10 to_full_addresses = []
11 for header in ['To', 'Cc', 'Bcc']:
12 value = message.get(header, None)
13 if value:
14 to_full_addresses.append(value)
15- to_emails = [pair[1] for pair in
16+ to_emails = [pair[1].encode('ascii', 'xmlcharrefreplace') for pair in
17 Utils.getaddresses(to_full_addresses)]
18
19 return from_email, to_emails
20@@ -120,7 +120,7 @@
21 try:
22 self._connect()
23 self._connection.sendmail(from_email, to_emails,
24- message.as_string())
25+ message.as_string().encode('ascii', 'xmlcharrefreplace'))
26 except (socket.error, smtplib.SMTPException), e:
27 self.disconnect()
28 raise SendEmailError(e)

Subscribers

People subscribed via source and target branches

to all changes: