Skip to content

Instantly share code, notes, and snippets.

@dunossauro
Last active January 10, 2017 15:22
Show Gist options
  • Save dunossauro/4f834181af5332abe70dd3a41a5ec06c to your computer and use it in GitHub Desktop.
Save dunossauro/4f834181af5332abe70dd3a41a5ec06c to your computer and use it in GitHub Desktop.
enviando e-mail com python
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