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
- from_addr = 'myemail@gmail.com'
- to_addr = 'toemail@gmail.com'
- bcc = ['other@gmail.com', 'myemail@gmail.com', 'email@gmail.com']
- msg = MIMEMultipart()
- msg['From'] = from_addr
- msg['To'] = to_addr
- msg['Subject'] = 'New Releases'
- body = """ New Releases and Sales!
- Click the links below to check them out!
- """
- msg.attach(MIMEText(body, 'plain'))
- smtp_server = smtplib.SMTP('smtp.gmail.com', 587)
- smtp_server.ehlo()
- smtp_server.starttls()
- smtp_server.login(' myemail@gmail.com ', ' <application id> ')
- text = msg.as_string()
- smtp_server.sendmail(from_addr, [to_addr] + bcc, text)
- smtp_server.quit()
- print('Email sent successfully')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement