I have sent a message with mailer and got this:
To fix it when I send a message I just:
from email.utils import make_msgid
def enviar_correo_smtp(destinatario, asunto, mensaje_html):
try:
message_id = make_msgid()
mailer.send(
to=destinatario,
subject=asunto,
body=mensaje_html,
headers={"Message-ID": message_id},)
return 200, {"status": "success", "message": "Correo enviado con SMTP"}
except Exception as e:
return 500, {"error": str(e)}
But, I suggest making it available to any mail in mailer.py
LN 830 ... if self.settings.login:
server.login(*self.settings.login.split(":", 1))
# Add Message-ID si doesn´t exists
if "Message-ID" not in payload:
payload["Message-ID"] = email.utils.make_msgid()
result = server.sendmail(sender, to, payload.as_string())