Commit 6ad8231d authored by Andreas Jung's avatar Andreas Jung

Added support for force_tls flag. Leaving the no_tls flag out right now.

parent 555014ea
...@@ -97,7 +97,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager): ...@@ -97,7 +97,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
def __init__(self, id='', title='', smtp_host='localhost', smtp_port=25, def __init__(self, id='', title='', smtp_host='localhost', smtp_port=25,
force_tls=False, no_tls=False, force_tls=False,
smtp_uid='', smtp_pwd='', smtp_queue=False, smtp_queue_directory='/tmp'): smtp_uid='', smtp_pwd='', smtp_queue=False, smtp_queue_directory='/tmp'):
"""Initialize a new MailHost instance """ """Initialize a new MailHost instance """
self.id = id self.id = id
...@@ -107,7 +107,6 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager): ...@@ -107,7 +107,6 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
self.smtp_uid = smtp_uid self.smtp_uid = smtp_uid
self.smtp_pwd = smtp_pwd self.smtp_pwd = smtp_pwd
self.force_tls = force_tls self.force_tls = force_tls
self.no_tls = no_tls
self.smtp_queue = smtp_queue self.smtp_queue = smtp_queue
self.smtp_queue_directory = smtp_queue_directory self.smtp_queue_directory = smtp_queue_directory
...@@ -120,7 +119,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager): ...@@ -120,7 +119,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
security.declareProtected(change_configuration, 'manage_makeChanges') security.declareProtected(change_configuration, 'manage_makeChanges')
def manage_makeChanges(self,title,smtp_host,smtp_port,smtp_uid='',smtp_pwd='', def manage_makeChanges(self,title,smtp_host,smtp_port,smtp_uid='',smtp_pwd='',
smtp_queue=False, smtp_queue_directory='/tmp', smtp_queue=False, smtp_queue_directory='/tmp',
force_tls=False, no_tls=False, force_tls=False,
REQUEST=None): REQUEST=None):
'make the changes' 'make the changes'
...@@ -133,7 +132,6 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager): ...@@ -133,7 +132,6 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
self.smtp_port=smtp_port self.smtp_port=smtp_port
self.smtp_uid = smtp_uid self.smtp_uid = smtp_uid
self.smtp_pwd = smtp_pwd self.smtp_pwd = smtp_pwd
self.no_tls = no_tls
self.force_tls = force_tls self.force_tls = force_tls
self.smtp_queue = smtp_queue self.smtp_queue = smtp_queue
self.smtp_queue_directory = smtp_queue_directory self.smtp_queue_directory = smtp_queue_directory
...@@ -196,10 +194,9 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager): ...@@ -196,10 +194,9 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
def _makeMailer(self): def _makeMailer(self):
""" Create a SMTPMailer """ """ Create a SMTPMailer """
return SMTPMailer(hostname=self.smtp_host, return SMTPMailer(hostname=self.smtp_host,
int(self.smtp_port), port=int(self.smtp_port),
username=self.smtp_uid or None, username=self.smtp_uid or None,
password=self.smtp_pwd or None, password=self.smtp_pwd or None,
no_tls=self.no_tls,
force_tls=self.force_tls force_tls=self.force_tls
) )
......
...@@ -76,6 +76,23 @@ ...@@ -76,6 +76,23 @@
<span class="form-help">(optional for SMTP AUTH)</span> <span class="form-help">(optional for SMTP AUTH)</span>
</td> </td>
</tr> </tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Force TLS
</div>
</td>
<td align="left" valign="top">
<input type="checkbox" name="force_tls:boolean" value="1"
<dtml-if "force_tls">checked</dtml-if>
</td>
<td>
<span class="form-help">(enforce the use of an encrypted connection
to the SMTP server. Mail delivery fails if the SMTP server
does not support encryption)
</span>
</td>
</tr>
<tr> <tr>
<td align="left" valign="top"> <td align="left" valign="top">
<div class="form-label"> <div class="form-label">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment