Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- # Import the email modules we'll need
- from email.mime.text import MIMEText
- from typing import TextIO
- smtp_ssl_host = 'smtp.gmail.com'
- #SMTP over SSL - Conflito registrado com protocolo Cisco
- smtp_ssl_port = 465
- #conta
- username = 'raelmotta229@gmail.com'
- password = 'fuchsfox'
- #remetente
- sender = 'raelmotta229@hotmail.com'
- targets = ['raelmotta229@gmail.com', 'raelmotta229@hotmail.com']
- #criar um arquivo e enviar
- text = open("C:\Users\raelm\PycharmProjects\aula-teste\msg1.txt", 'r')
- msg = MIMEText(text)
- msg['Subject'] = 'Hello'
- msg['From'] = sender
- msg['To'] = ', '.join(targets)
- server = smtplib.SMTP_SSL(smtp_ssl_host, smtp_ssl_port)
- server.login(username, password)
- server.sendmail(sender, targets, msg.as_string())
- server.quit()
Add Comment
Please, Sign In to add comment