Mercurial > p > roundup > code
comparison roundup/mailer.py @ 2124:6deda7ff3b2a
*** empty log message ***
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 25 Mar 2004 22:53:26 +0000 |
| parents | 95da13c1bdbd |
| children | e49e6c7b14fb |
comparison
equal
deleted
inserted
replaced
| 2123:95da13c1bdbd | 2124:6deda7ff3b2a |
|---|---|
| 1 """Sending Roundup-specific mail over SMTP. | 1 """Sending Roundup-specific mail over SMTP. |
| 2 """ | 2 """ |
| 3 __docformat__ = 'restructuredtext' | 3 __docformat__ = 'restructuredtext' |
| 4 # $Id: mailer.py,v 1.8 2004-03-25 22:52:12 richard Exp $ | 4 # $Id: mailer.py,v 1.9 2004-03-25 22:53:26 richard Exp $ |
| 5 | 5 |
| 6 import time, quopri, os, socket, smtplib, re | 6 import time, quopri, os, socket, smtplib, re |
| 7 | 7 |
| 8 from cStringIO import StringIO | 8 from cStringIO import StringIO |
| 9 from MimeWriter import MimeWriter | 9 from MimeWriter import MimeWriter |
| 97 ERROR_MESSAGES_TO setting. | 97 ERROR_MESSAGES_TO setting. |
| 98 - error: the reason of failure as a string. | 98 - error: the reason of failure as a string. |
| 99 - subject: the subject as a string. | 99 - subject: the subject as a string. |
| 100 | 100 |
| 101 """ | 101 """ |
| 102 message, writer = self.get_standard_message(to, subject) | |
| 103 | |
| 104 # see whether we should send to the dispatcher or not | 102 # see whether we should send to the dispatcher or not |
| 105 dispatcher_email = getattr(self.config, "DISPATCHER_EMAIL", | 103 dispatcher_email = getattr(self.config, "DISPATCHER_EMAIL", |
| 106 getattr(self.config, "ADMIN_EMAIL")) | 104 getattr(self.config, "ADMIN_EMAIL")) |
| 107 error_messages_to = getattr(self.config, "ERROR_MESSAGES_TO", "user") | 105 error_messages_to = getattr(self.config, "ERROR_MESSAGES_TO", "user") |
| 108 if error_messages_to == "dispatcher": | 106 if error_messages_to == "dispatcher": |
| 109 to = [dispatcher_email] | 107 to = [dispatcher_email] |
| 110 elif error_messages_to == "both": | 108 elif error_messages_to == "both": |
| 111 to.append(dispatcher_email) | 109 to.append(dispatcher_email) |
| 110 | |
| 111 message, writer = self.get_standard_message(to, subject) | |
| 112 | 112 |
| 113 part = writer.startmultipartbody('mixed') | 113 part = writer.startmultipartbody('mixed') |
| 114 part = writer.nextpart() | 114 part = writer.nextpart() |
| 115 part.addheader('Content-Transfer-Encoding', 'quoted-printable') | 115 part.addheader('Content-Transfer-Encoding', 'quoted-printable') |
| 116 body = part.startbody('text/plain; charset=utf-8') | 116 body = part.startbody('text/plain; charset=utf-8') |
