Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import email
- import smtplib
- import urllib, urllib3
- import mimetypes
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- from email.mime.base import MIMEBase
- from email import encoders
- import plotly
- import plotly.tools as tls
- import urllib.request
- msg = MIMEMultipart()
- recipients = ['recipients@email.com'] #'person1@email.com', 'person2@email.com'
- password = "Password"
- msg['From'] = "from@email.com"
- msg['To'] = ", ".join(recipients)
- msg['Subject'] = "Subject"
- html = """
- <html>
- <head>
- <style type="text/css# media="screen">
- table{
- background-color: #FFDE24;
- empty-cells:hide;
- }
- td.cell{
- background-color: white;
- }
- </style>
- </head>
- <body>
- <p><br>
- This is the first part of the HTML</p>
- </body>
- </html>
- """
- html1 = """
- <html>
- <head>
- <style type="text/css# media="screen">
- table{
- background-color: #FFDE24;
- empty-cells:hide;
- }
- td.cell{
- background-color: white;
- }
- </style>
- </head>
- <body>
- <p><br>
- This is the second part of the HTML</p>
- </body>
- </html>
- """
- msg.attach(MIMEText(html, 'html'))
- msg.attach(MIMEText(html1, 'html'))
- server = smtplib.SMTP('smtp.gmail.com: 587')
- server.starttls()
- server.login'from@email.com', password)
- server.sendmail(msg['From'], recipients, msg.as_string())
- server.quit()
- print ("Successfully Sent Email to %s:" % (msg['To']))
Add Comment
Please, Sign In to add comment