set SMTP timeout to 10 seconds and make it configurable, ref 9a735e8

This commit is contained in:
Martin Zimmermann 2014-03-04 09:47:54 +01:00
parent 72c38c2312
commit 3b248b293f
4 changed files with 11 additions and 1 deletions

View File

@ -162,6 +162,7 @@ also can moderate (=activate or delete) comments. Don't forget to configure
security = starttls
to =
from =
timeout = 10
username
self-explanatory, optional
@ -188,6 +189,10 @@ to
from
sender address, e.g. isso@example.tld
timeout
specify a timeout in seconds for blocking operations like the
connection attempt.
Guard
-----

View File

@ -91,6 +91,10 @@ to =
# sender address, e.g. isso@example.tld
from =
# specify a timeout in seconds for blocking operations like the
# connection attempt.
timeout = 10
[guard]
# Enable basic spam protection features, e.g. rate-limit per IP address (/24 for

View File

@ -128,6 +128,7 @@ class Config:
"username = ", "password = ",
"host = localhost", "port = 587", "security = starttls",
"to = ", "from = ",
"timeout = 10",
"[guard]",
"enabled = true",
"ratelimit = 2",

View File

@ -60,7 +60,7 @@ class SMTP(object):
klass = (smtplib.SMTP_SSL if self.conf.get('security') == 'ssl' else smtplib.SMTP)
self.client = klass(host=self.conf.get('host'),
port=self.conf.getint('port'),
timeout=5)
timeout=self.conf.getint('timeout'))
if self.conf.get('security') == 'starttls':
self.client.starttls();