Mercurial > p > roundup > code
comparison roundup/mailer.py @ 3548:61d48244e7a8
login may now be for a single session
trackers may hide exceptions from web users (they will be mailed to the
tracker admin)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 08 Feb 2006 03:47:28 +0000 |
| parents | f43424d545a6 |
| children | 3954fbcefae5 |
comparison
equal
deleted
inserted
replaced
| 3547:7728ee93efd2 | 3548:61d48244e7a8 |
|---|---|
| 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.14 2006-02-02 04:14:29 richard Exp $ | 4 # $Id: mailer.py,v 1.15 2006-02-08 03:47:28 richard Exp $ |
| 5 | 5 |
| 6 import time, quopri, os, socket, smtplib, re | 6 import time, quopri, os, socket, smtplib, re, sys, traceback |
| 7 | 7 |
| 8 from cStringIO import StringIO | 8 from cStringIO import StringIO |
| 9 from MimeWriter import MimeWriter | 9 from MimeWriter import MimeWriter |
| 10 | 10 |
| 11 from roundup.rfc2822 import encode_header | 11 from roundup.rfc2822 import encode_header |
| 140 body.write(bounced_message.fp.read()) | 140 body.write(bounced_message.fp.read()) |
| 141 | 141 |
| 142 writer.lastpart() | 142 writer.lastpart() |
| 143 | 143 |
| 144 self.smtp_send(to, message) | 144 self.smtp_send(to, message) |
| 145 | |
| 146 def exception_message(self): | |
| 147 '''Send a message to the admins with information about the latest | |
| 148 traceback. | |
| 149 ''' | |
| 150 subject = '%s: %s'%(self.config.TRACKER_NAME, sys.exc_info()[1]) | |
| 151 to = [self.config.ADMIN_EMAIL] | |
| 152 content = traceback.format_exc() | |
| 153 self.standard_message(to, subject, content) | |
| 145 | 154 |
| 146 def smtp_send(self, to, message): | 155 def smtp_send(self, to, message): |
| 147 """Send a message over SMTP, using roundup's config. | 156 """Send a message over SMTP, using roundup's config. |
| 148 | 157 |
| 149 Arguments: | 158 Arguments: |
