Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib, getpass
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- print("**** Enviar E-mail ****")
- user = input("Conta Outlook: ")
- password = input("Senha: ")
- De = input("De: ")
- Para = input("Para: ")
- Assunto = input("Assunto: ")
- Mensagem = input("Mensagem: ")
- #Host e porta SMTP de Outlook
- outlook = smtplib.SMTP('smtp.office365.com', 587)
- outlook.starttls()
- outlook.login(user, password)
- outlook.set_debuglevel(1)
- header = MIMEMultipart()
- header['Assunto'] = Assunto
- header['De'] = De
- header['Para'] = Para
- Mensagem = MIMEText(Mensagem, 'html') #Content-type:text/html
- header.attach(Mensagem)
- #Enviar email
- outlook.sendmail(De, Para, header.as_string())
- outlook.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement