bonjour,
je suis entrain de faire petite application pour envoyer un mail par SMTP en python, alors une recherche sur le net, j'ai trouvé le code suivant :
Le résultat est un message d'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #-*- coding: utf-8 -*- import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText msg = MIMEMultipart() msg['From'] = 'hichemdjaoui@gmail.com' msg['To'] = 'hichemdjaoui@gmail.com' msg['Subject'] = 'Le sujet de mon mail' message = 'Bonjour !' msg.attach(MIMEText(message)) mailserver = smtplib.SMTP('smtp.gmail.com', 587) mailserver.ehlo() mailserver.starttls() mailserver.ehlo() mailserver.login('hichemdjaoui@gmail.com', '12345') mailserver.sendmail('hichemdjaoui@gmail.com', 'hichemdjaoui@gmail.com', msg.as_string()) mailserver.quit()
Merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Traceback (most recent call last): File "C:\Users\del\Desktop\mail python\gmail.py", line 17, in <module> mailserver.login('hichemdjaoui@gmail.com', '12345') File "C:\Python27\lib\smtplib.py", line 592, in login raise SMTPAuthenticationError(code, resp) SMTPAuthenticationError: (534, '5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbup\n5.7.14 z7rh2sVs6wbRj6aqfQvaCAVR5IeQpWiotsX0XygblsPrqNoGbgB3LJa_75XivLN9CN8CJd\n5.7.14 AwQWs56duBEjcwYaLKtjigwyeknseIJS8iaMO2b4qZZ6_H2ugZaLD0tV3ImIiberRKzu_q\n5.7.14 nsB8q7JRExSVUoq0VGJfFoEi5hOvZbgw0vOLGROP5g5OKaatGALaOpGjC0GktnbWjvR2Gl\n5.7.14 ALHpTzvlnikpn5_PevZEWwue269oQ> Please log in via your web browser and\n5.7.14 then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 m5sm7146018wmd.17 - gsmtp')
Partager