Commit ee64b28c authored by Vinay Sajip's avatar Vinay Sajip

Closes #14314: backported fix.

parent a3481e70
...@@ -857,6 +857,7 @@ class SMTPHandler(logging.Handler): ...@@ -857,6 +857,7 @@ class SMTPHandler(logging.Handler):
self.toaddrs = toaddrs self.toaddrs = toaddrs
self.subject = subject self.subject = subject
self.secure = secure self.secure = secure
self._timeout = 5.0
def getSubject(self, record): def getSubject(self, record):
""" """
...@@ -879,7 +880,7 @@ class SMTPHandler(logging.Handler): ...@@ -879,7 +880,7 @@ class SMTPHandler(logging.Handler):
port = self.mailport port = self.mailport
if not port: if not port:
port = smtplib.SMTP_PORT port = smtplib.SMTP_PORT
smtp = smtplib.SMTP(self.mailhost, port) smtp = smtplib.SMTP(self.mailhost, port, timeout=self._timeout)
msg = self.format(record) msg = self.format(record)
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % ( msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % (
self.fromaddr, self.fromaddr,
......
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