comparison roundup/mailer.py @ 3878:6d14a3b4e295

allow admin to specify port and local hostname for SMTP connections
author Justus Pendleton <jpend@users.sourceforge.net>
date Sun, 02 Sep 2007 05:54:46 +0000
parents 35811df7c783
children 82f462d9ad16
comparison
equal deleted inserted replaced
3877:83748b2de465 3878:6d14a3b4e295
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.18 2006-08-11 01:41:25 richard Exp $ 4 # $Id: mailer.py,v 1.19 2007-09-02 05:54:46 jpend Exp $
5 5
6 import time, quopri, os, socket, smtplib, re, sys, traceback 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
188 188
189 class SMTPConnection(smtplib.SMTP): 189 class SMTPConnection(smtplib.SMTP):
190 ''' Open an SMTP connection to the mailhost specified in the config 190 ''' Open an SMTP connection to the mailhost specified in the config
191 ''' 191 '''
192 def __init__(self, config): 192 def __init__(self, config):
193 193 smtplib.SMTP.__init__(self, config.MAILHOST, port=config['MAIL_PORT'],
194 smtplib.SMTP.__init__(self, config.MAILHOST) 194 local_hostname=config['MAIL_LOCAL_HOSTNAME'])
195 195
196 # start the TLS if requested 196 # start the TLS if requested
197 if config["MAIL_TLS"]: 197 if config["MAIL_TLS"]:
198 self.starttls(config["MAIL_TLS_KEYFILE"], 198 self.starttls(config["MAIL_TLS_KEYFILE"],
199 config["MAIL_TLS_CERTFILE"]) 199 config["MAIL_TLS_CERTFILE"])

Roundup Issue Tracker: http://roundup-tracker.org/