Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee64b28

Browse files
committed
Closes #14314: backported fix.
1 parent a3481e7 commit ee64b28

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/logging/handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,7 @@ def __init__(self, mailhost, fromaddr, toaddrs, subject,
857857
self.toaddrs = toaddrs
858858
self.subject = subject
859859
self.secure = secure
860+
self._timeout = 5.0
860861

861862
def getSubject(self, record):
862863
"""
@@ -879,7 +880,7 @@ def emit(self, record):
879880
port = self.mailport
880881
if not port:
881882
port = smtplib.SMTP_PORT
882-
smtp = smtplib.SMTP(self.mailhost, port)
883+
smtp = smtplib.SMTP(self.mailhost, port, timeout=self._timeout)
883884
msg = self.format(record)
884885
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % (
885886
self.fromaddr,

0 commit comments

Comments
 (0)