Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtp
- message = 'shit'
- # setup the parameters of the message
- HOST = 'dutypare-com.mail.protection.outlook.com'
- PORT = '587'
- msg['From'] = sender
- msg['To'] = receivers
- msg['Subject'] = "Subscription"
- # add in the message body
- msg.attach(MIMEText(message, 'plain'))
- #create server
- server = smtplib.SMTP_SSL(HOST, PORT)
- server.starttls()
- # Login Credentials for sending the mail
- server.login(msg['From'], password)
- # send the message via the server.
- server.sendmail(msg['From'], msg['To'], msg.as_string())
- server.quit()
- print("successfully sent email to %s:" % (msg['To']))
Add Comment
Please, Sign In to add comment