set SMTP timeout to 10 seconds and make it configurable, ref 9a735e8
This commit is contained in:
parent
72c38c2312
commit
3b248b293f
@ -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
|
||||
-----
|
||||
|
@ -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
|
||||
|
@ -128,6 +128,7 @@ class Config:
|
||||
"username = ", "password = ",
|
||||
"host = localhost", "port = 587", "security = starttls",
|
||||
"to = ", "from = ",
|
||||
"timeout = 10",
|
||||
"[guard]",
|
||||
"enabled = true",
|
||||
"ratelimit = 2",
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user