Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1612:e109d59f232d
SMTP login and TLS support added ([SF#710853] with extras ;)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 24 Apr 2003 07:20:00 +0000 |
| parents | caae7d8934dc |
| children | 8a908bbad1ef |
comparison
equal
deleted
inserted
replaced
| 1611:db8545f10476 | 1612:e109d59f232d |
|---|---|
| 1 # $Id: client.py,v 1.113 2003-04-10 05:12:41 richard Exp $ | 1 # $Id: client.py,v 1.114 2003-04-24 07:19:59 richard Exp $ |
| 2 | 2 |
| 3 __doc__ = """ | 3 __doc__ = """ |
| 4 WWW request handler (also used in the stand-alone server). | 4 WWW request handler (also used in the stand-alone server). |
| 5 """ | 5 """ |
| 6 | 6 |
| 12 from roundup.i18n import _ | 12 from roundup.i18n import _ |
| 13 from roundup.cgi.templating import Templates, HTMLRequest, NoTemplate | 13 from roundup.cgi.templating import Templates, HTMLRequest, NoTemplate |
| 14 from roundup.cgi import cgitb | 14 from roundup.cgi import cgitb |
| 15 from roundup.cgi.PageTemplates import PageTemplate | 15 from roundup.cgi.PageTemplates import PageTemplate |
| 16 from roundup.rfc2822 import encode_header | 16 from roundup.rfc2822 import encode_header |
| 17 from roundup.mailgw import uidFromAddress | 17 from roundup.mailgw import uidFromAddress, openSMTPConnection |
| 18 | 18 |
| 19 class HTTPException(Exception): | 19 class HTTPException(Exception): |
| 20 pass | 20 pass |
| 21 class Unauthorised(HTTPException): | 21 class Unauthorised(HTTPException): |
| 22 pass | 22 pass |
| 785 else: | 785 else: |
| 786 # now try to send the message | 786 # now try to send the message |
| 787 try: | 787 try: |
| 788 # send the message as admin so bounces are sent there | 788 # send the message as admin so bounces are sent there |
| 789 # instead of to roundup | 789 # instead of to roundup |
| 790 smtp = smtplib.SMTP(self.db.config.MAILHOST) | 790 smtp = openSMTPConnection(self.db.config) |
| 791 smtp.sendmail(self.db.config.ADMIN_EMAIL, [to], | 791 smtp.sendmail(self.db.config.ADMIN_EMAIL, [to], |
| 792 message.getvalue()) | 792 message.getvalue()) |
| 793 except socket.error, value: | 793 except socket.error, value: |
| 794 self.error_message.append("Error: couldn't send email: " | 794 self.error_message.append("Error: couldn't send email: " |
| 795 "mailhost %s"%value) | 795 "mailhost %s"%value) |
