Bonjour.
Je découve Brevo avec le plan gratuit.
J’ai bien créé un compte, puis généré une clé SMTP.
J’essaie de m’envoyer à moi même un email de test avec le code Python suivant, mais je ne reçois rien (je suis sur gmail); pourtant je lis sur l’interface utilisateur de Brevo que 4 mails ont été envoyés et les messages de debug ont l’air d’indiquer que tout se passe correctement.
Merci d’avance pour votre aide.
le code python:
import smtplib
CLIENT_EMAIL = "moi@gmail.com"
ORIGIN_EMAIL = "identifier@smtp-brevo.com"
MESSAGING_PWD = "xsmtpsib-xxxxxxxxxx"
mail = f"""Subject: testing
To: {CLIENT_EMAIL}
From: {ORIGIN_EMAIL}
Ceci est un email de test"""
with smtplib.SMTP("smtp-relay.brevo.com", 587) as messaging:
messaging.set_debuglevel(1)
messaging.login(ORIGIN_EMAIL, MESSAGING_PWD)
messaging.sendmail(ORIGIN_EMAIL, CLIENT_EMAIL, mail)
Et voici les logs:
send: 'ehlo [192.167.15.83]\r\n'
reply: b'250-Hello [192.167.15.83]\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-AUTH CRAM-MD5 PLAIN LOGIN\r\n'
reply: b'250 SIZE 20971520\r\n'
reply: retcode (250); Msg: b'Hello [192.167.15.83]\nPIPELINING\n8BITMIME\nENHANCEDSTATUSCODES\nCHUNKING\nSTARTTLS\nAUTH CRAM-MD5 PLAIN LOGIN\nSIZE 20971520'
send: 'AUTH CRAM-MD5\r\n'
reply: b'334 PDEuNTMwNDI2OTdAWzE5Mi4xNjguMS44M10+\r\n'
reply: retcode (334); Msg: b'PDEuNTMwNDI2OTdAWzE5Mi4xNjguMS44M10+'
send: 'ODQwNzNtdHAtYnJldm8uY29tIDEwYTA3ZmE1NDBjMWMyODI0YjMxNTM1NTQy\r\n'
reply: b'235 2.0.0 Authentication succeeded\r\n'
reply: retcode (235); Msg: b'2.0.0 Authentication succeeded'
send: 'mail from:<identifier@smtp-brevo.com> size=105\r\n'
reply: b'250 2.0.0 Roger, accepting mail from <identifier@smtp-brevo.com>\r\n'
reply: retcode (250); Msg: b'2.0.0 Roger, accepting mail from <identifier@smtp-brevo.com>'
send: 'rcpt to:<moi@gmail.com>\r\n'
reply: b"250 2.0.0 I'll make sure <moi@gmail.com> gets this\r\n"
reply: retcode (250); Msg: b"2.0.0 I'll make sure <moi@gmail.com> gets this"
send: 'data\r\n'
reply: b'354 Go ahead. End your data with <CR><LF>.<CR><LF>\r\n'
reply: retcode (354); Msg: b'Go ahead. End your data with <CR><LF>.<CR><LF>'
data: (354, b'Go ahead. End your data with <CR><LF>.<CR><LF>')
send: b'Subject: testing\r\nTo: moi@gmail.com\r\nFrom: identifier@smtp-brevo.com\r\n\r\nCeci est un email de test\r\n.\r\n'
reply: b'250 2.0.0 OK: queued as <202501261238.53568612066@smtp-relay.sendinblue.com>\r\n'
reply: retcode (250); Msg: b'2.0.0 OK: queued as <202501261238.53568612066@smtp-relay.sendinblue.com>'
data: (250, b'2.0.0 OK: queued as <202501261238.53568612066@smtp-relay.sendinblue.com>')
send: 'QUIT\r\n'
reply: b'221 2.0.0 Bye\r\n'
reply: retcode (221); Msg: b'2.0.0 Bye'