Mercurial > p > roundup > code
comparison roundup/roundupdb.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 | d1bab419f2a2 |
| children | b3abda04a690 |
comparison
equal
deleted
inserted
replaced
| 1611:db8545f10476 | 1612:e109d59f232d |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: roundupdb.py,v 1.84 2003-04-14 06:24:01 richard Exp $ | 18 # $Id: roundupdb.py,v 1.85 2003-04-24 07:19:58 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Extending hyperdb with types specific to issue-tracking. | 21 Extending hyperdb with types specific to issue-tracking. |
| 22 """ | 22 """ |
| 23 | 23 |
| 41 quotes = '"' | 41 quotes = '"' |
| 42 name = escapesre.sub(r'\\\g<0>', name) | 42 name = escapesre.sub(r'\\\g<0>', name) |
| 43 return '%s%s%s <%s>' % (quotes, name, quotes, address) | 43 return '%s%s%s <%s>' % (quotes, name, quotes, address) |
| 44 return address | 44 return address |
| 45 | 45 |
| 46 import hyperdb | 46 from roundup import hyperdb |
| 47 from roundup.mailgw import openSMTPConnection | |
| 47 | 48 |
| 48 # set to indicate to roundup not to actually _send_ email | 49 # set to indicate to roundup not to actually _send_ email |
| 49 # this var must contain a file to write the mail to | 50 # this var must contain a file to write the mail to |
| 50 SENDMAILDEBUG = os.environ.get('SENDMAILDEBUG', '') | 51 SENDMAILDEBUG = os.environ.get('SENDMAILDEBUG', '') |
| 51 | 52 |
| 331 ', '.join(sendto),message.getvalue())) | 332 ', '.join(sendto),message.getvalue())) |
| 332 else: | 333 else: |
| 333 try: | 334 try: |
| 334 # send the message as admin so bounces are sent there | 335 # send the message as admin so bounces are sent there |
| 335 # instead of to roundup | 336 # instead of to roundup |
| 336 smtp = smtplib.SMTP(self.db.config.MAILHOST) | 337 smtp = openSMTPConnection(self.db.config) |
| 337 smtp.sendmail(self.db.config.ADMIN_EMAIL, sendto, | 338 smtp.sendmail(self.db.config.ADMIN_EMAIL, sendto, |
| 338 message.getvalue()) | 339 message.getvalue()) |
| 339 except socket.error, value: | 340 except socket.error, value: |
| 340 raise MessageSendError, \ | 341 raise MessageSendError, \ |
| 341 "Couldn't send confirmation email: mailhost %s"%value | 342 "Couldn't send confirmation email: mailhost %s"%value |
