[Zope-Checkins]
SVN: Zope/trunk/lib/python/Products/MailHost/MailHost.py
support for no_tls, force_tls options
Andreas Jung
andreas at andreas-jung.com
Fri Aug 24 11:35:27 EDT 2007
Log message for revision 79238:
support for no_tls, force_tls options
Changed:
U Zope/trunk/lib/python/Products/MailHost/MailHost.py
-=-
Modified: Zope/trunk/lib/python/Products/MailHost/MailHost.py
===================================================================
--- Zope/trunk/lib/python/Products/MailHost/MailHost.py 2007-08-24 14:50:30 UTC (rev 79237)
+++ Zope/trunk/lib/python/Products/MailHost/MailHost.py 2007-08-24 15:35:27 UTC (rev 79238)
@@ -96,8 +96,9 @@
)
- def __init__( self, id='', title='', smtp_host='localhost', smtp_port=25,
- smtp_uid='', smtp_pwd='', smtp_queue=False, smtp_queue_directory='/tmp'):
+ def __init__(self, id='', title='', smtp_host='localhost', smtp_port=25,
+ force_tls=False, no_tls=False,
+ smtp_uid='', smtp_pwd='', smtp_queue=False, smtp_queue_directory='/tmp'):
"""Initialize a new MailHost instance """
self.id = id
self.title = title
@@ -105,6 +106,8 @@
self.smtp_port = int(smtp_port)
self.smtp_uid = smtp_uid
self.smtp_pwd = smtp_pwd
+ self.force_tls = force_tls
+ self.no_tls = no_tls
self.smtp_queue = smtp_queue
self.smtp_queue_directory = smtp_queue_directory
@@ -117,6 +120,7 @@
security.declareProtected(change_configuration, 'manage_makeChanges')
def manage_makeChanges(self,title,smtp_host,smtp_port,smtp_uid='',smtp_pwd='',
smtp_queue=False, smtp_queue_directory='/tmp',
+ force_tls=False, no_tls=False,
REQUEST=None):
'make the changes'
@@ -129,6 +133,8 @@
self.smtp_port=smtp_port
self.smtp_uid = smtp_uid
self.smtp_pwd = smtp_pwd
+ self.no_tls = no_tls
+ self.force_tls = force_tls
self.smtp_queue = smtp_queue
self.smtp_queue_directory = smtp_queue_directory
@@ -189,10 +195,12 @@
def _makeMailer(self):
""" Create a SMTPMailer """
- return SMTPMailer(self.smtp_host,
+ return SMTPMailer(hostname=self.smtp_host,
int(self.smtp_port),
- self.smtp_uid or None,
- self.smtp_pwd or None
+ username=self.smtp_uid or None,
+ password=self.smtp_pwd or None,
+ no_tls=self.no_tls,
+ force_tls=self.force_tls
)
@synchronized(lock)
@@ -205,7 +213,7 @@
thread.stop()
while thread.isAlive():
# wait until thread is really dead
- time.sleep(0.1)
+ time.sleep(0.3)
del queue_threads[path]
LOG.info('Thread for %s stopped' % path)
More information about the Zope-Checkins
mailing list