Python/SMTP: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
try:
try:
     with smtplib.SMTP(HOST, PORT, timeout = TIMEOUT) as smtp:
     with smtplib.SMTP(HOST, PORT, timeout = TIMEOUT) as smtp:
         smtp.set_debuglevel(2)
         # smtp.set_debuglevel(2)
         # smtp.starttls()
         # smtp.starttls()
         # smtp.login(USER, PASS)
         # smtp.login(USER, PASS)

Revision as of 09:44, 5 June 2018

try:
    with smtplib.SMTP(HOST, PORT, timeout = TIMEOUT) as smtp:
        # smtp.set_debuglevel(2)
        # smtp.starttls()
        # smtp.login(USER, PASS)
        smtp.sendmail(FROM, RCPT, message)
except smtplib.SMTPConnectError:
    pass
except smtplib.SMTPServerDisconnected:
    pass
except:
    pass