Je le code suivantpython erreur d'authentification smtp gmail (envoi de courrier électronique via le serveur smtp gmail)
import smtplib
from email.mime.text import MIMEText
smtpserver = 'smtp.gmail.com'
AUTHREQUIRED = 1 # if you need to use SMTP AUTH set to 1
smtpuser = '[email protected]' # for SMTP AUTH, set SMTP username here
smtppass = '123456' # for SMTP AUTH, set SMTP password here
RECIPIENTS = ['[email protected]']
SENDER = '[email protected]'
msg = MIMEText('dsdsdsdsds\n')
msg['Subject'] = 'The contents of iii'
msg['From'] = '[email protected]'
msg['To'] = ''[email protected]''
mailServer = smtplib.SMTP('smtp.gmail.com',587)
mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()
mailServer.login(smtpuser, smtppass)
mailServer.sendmail(smtpuser,RECIPIENTS,msg.as_string())
mailServer.close()
ce code fonctionne très bien sur mon bureau. mais il a échoué avec cette erreur
smtplib.SMTPAuthenticationError: (535, '5.7.1 Username and Password not accepted. Learn more at\n5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 21sm4713429agd.11')
sur mon serveur Linux.
Vous ne savez pas ce qui s'est mal passé, devrais-je ouvrir un port sur mon serveur Linux?
mon bureau utilise python2.5 (fonctionnant), boîte linux utilisant python2.6 (falied) – icn