Last active
January 10, 2017 15:22
-
-
Save dunossauro/4f834181af5332abe70dd3a41a5ec06c to your computer and use it in GitHub Desktop.
enviando e-mail com python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
msg = MIMEMultipart('alternative') | |
msg['Subject'] = "ASSUNTO" | |
msg['From'] = "[email protected]" | |
msg['To'] = "[email protected]" | |
text = "Olá Python" | |
msg = MIMEText(text, 'plain') | |
msg.attach(msg) | |
mail = smtplib.SMTP('smtp.gmail.com', 587) | |
mail.ehlo() | |
mail.starttls() | |
mail.login("[email protected]", "password") | |
mail.sendmail(me, you, msg.as_string()) | |
mail.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment