Message335524
Here is my suggestion
class SMTPSSLHander(SMTPHandler):
def emit(self, record):
"""
Emit a record.
Format the record and send it to the specified addressees.
"""
try:
import smtplib
from email.message import EmailMessage
import email.utils
port = self.mailport
if not port:
port = smtplib.SMTP_SSL_PORT
keyfile = self.secure[0] if len(self.secure) > 0 else None
certfile = self.secure[1] if len(self.secure) > 1 else None
smtp = smtplib.SMTP_SSL(self.mailhost, port, timeout=self.timeout,
keyfile=keyfile, certfile=certfile)
if self.username:
smtp.login(self.username, self.password)
msg = EmailMessage()
msg['From'] = self.fromaddr
msg['To'] = ','.join(self.toaddrs)
msg['Subject'] = self.getSubject(record)
msg['Date'] = email.utils.localtime()
msg.set_content(self.format(record))
smtp.send_message(msg)
smtp.quit()
except Exception:
self.handleError(record) |
|
Date |
User |
Action |
Args |
2019-02-14 12:26:24 | matrixise | set | recipients:
+ matrixise, vinay.sajip, eamanu, lidayan |
2019-02-14 12:26:24 | matrixise | set | messageid: <1550147184.8.0.689462905309.issue35995@roundup.psfhosted.org> |
2019-02-14 12:26:24 | matrixise | link | issue35995 messages |
2019-02-14 12:26:24 | matrixise | create | |
|