Skip to content
Snippets Groups Projects
Commit 08b8c46a authored by Colombain Agathe's avatar Colombain Agathe
Browse files

Upload New File

parent 40035205
No related branches found
No related tags found
No related merge requests found
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def send_mail(email, subject, body):
smtp_server = 'smtp.gmail.com'
smtp_port = 587
smtp_username = 'agatheccl@gmail.com'
smtp_password = 'wpkg amco ipcr gmbj'
message = MIMEMultipart()
message['From'] = smtp_username
message['To'] = email
message['Subject'] = subject
message.attach(MIMEText(body, 'plain'))
with smtplib.SMTP(smtp_server, smtp_port) as server:
server.starttls()
server.login(smtp_username, smtp_password)
server.sendmail(smtp_username, to_email, message.as_string())
to_email = 'agathe@colombain.com'
subject = 'Test d\'envoi d\'e-mail'
body = 'Bonjour, ceci est un test d\'envoi d\'e-mail depuis un script Python.'
send_mail(to_email, subject, body)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment