Mercurial > p > roundup > code
comparison roundup/mailer.py @ 4236:2f4cee0e31e2
better construction of plain text
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 10 Aug 2009 03:33:28 +0000 |
| parents | 57dfcc824acc |
| children | 630a20c51345 |
comparison
equal
deleted
inserted
replaced
| 4235:d5f67a6eb32e | 4236:2f4cee0e31e2 |
|---|---|
| 67 author = formataddr((name, author[1])) | 67 author = formataddr((name, author[1])) |
| 68 | 68 |
| 69 if multipart: | 69 if multipart: |
| 70 message = MIMEMultipart() | 70 message = MIMEMultipart() |
| 71 else: | 71 else: |
| 72 message = Message() | 72 message = MIMEText("") |
| 73 message.set_type('text/plain') | |
| 74 message.set_charset(charset) | 73 message.set_charset(charset) |
| 75 | 74 |
| 76 try: | 75 try: |
| 77 message['Subject'] = subject.encode('ascii') | 76 message['Subject'] = subject.encode('ascii') |
| 78 except UnicodeError: | 77 except UnicodeError: |
| 95 | 94 |
| 96 # and another one to avoid loops | 95 # and another one to avoid loops |
| 97 message['X-Roundup-Loop'] = 'hello' | 96 message['X-Roundup-Loop'] = 'hello' |
| 98 # finally, an aid to debugging problems | 97 # finally, an aid to debugging problems |
| 99 message['X-Roundup-Version'] = __version__ | 98 message['X-Roundup-Version'] = __version__ |
| 100 | |
| 101 message['MIME-Version'] = '1.0' | |
| 102 | 99 |
| 103 return message | 100 return message |
| 104 | 101 |
| 105 def standard_message(self, to, subject, content, author=None): | 102 def standard_message(self, to, subject, content, author=None): |
| 106 """Send a standard message. | 103 """Send a standard message. |
