Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sendEmail(e):
- SMTPserver = 'outlook.office365.com'
- sender = 'x'
- destination = ['x']
- USERNAME = "x"
- PASSWORD = "x"
- text_subtype = 'plain'
- content="""
- Test message
- """
- subject = str(e)
- try:
- msg = MIMEText(content, text_subtype)
- msg['Subject'] = subject
- msg['From'] = sender
- conn = SMTP(SMTPserver) #THIS IS WHERE IT GETS STUCK
- conn.set_debuglevel(False)
- conn.login(USERNAME, PASSWORD)
- try:
- conn.sendmail(sender, destination, msg.as_string())
- finally:
- conn.quit()
- except Exception:
- print( "mail failed" ) # give a error message
- print(traceback.format_exc())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement