Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- msg = MIMEMultipart('alternative')
- msg['Subject'] = "High temps from sensor!"
- msg['From'] ="dummy1@hotmail.com"
- msg['To'] ="dummy2@hotmail.com,dummy3@hotmail.com"
- txt = "Fire? check tempature sensor!"
- html"""\
- <html>
- <head></head>
- <body>
- <h1>Fire??</h1>
- <p>
- Check tempature sensor!!
- </p>
- </body>
- </html>"""
- part1 = MIMEText(text, 'plain')
- part2 = MIMEText(html, 'html')
- msg.attach(part1)
- msg.attach(part2)
- msg = smtplib.SMTP("smtp.gmail.com",587)
- mail.ehlo()
- mail.starttls()
- mail.login('xxx@gmail.com','xxx')
- mail.sendmail('from@gmail.com, to@gmail.com', msg.as_string())
- mail.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement