def send_mail_reinit(destination_address, token):
source_address = info_mail.mail
body = "Rendez-vous à cette adresse pour réinitialiser votre mot de passe - localhost:5000/changer-mot-de-passe/" + token
subject = "Récupération du mot de passe CMS TP2"
msg = MIMEMultipart()
msg['Subject'] = subject
msg['From'] = source_address
msg['To'] = destination_address
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(source_address, info_mail.mdp)
text = msg.as_string()
server.sendmail(source_address, destination_address, text)
server.quit()
评论列表
文章目录