ignore email sent from a reverse-alias

This commit is contained in:
Son NK 2021-03-15 19:55:22 +01:00
parent 7811f06fc1
commit 82154ec858
1 changed files with 9 additions and 0 deletions

View File

@ -1529,6 +1529,15 @@ def handle(envelope: Envelope) -> str:
envelope.mail_from = mail_from
envelope.rcpt_tos = rcpt_tos
contact = Contact.get_by(reply_email=mail_from)
if contact:
LOG.exception(
"email can't be sent from a reverse-alias alias:%s, contact email:%s",
contact.alias,
contact.website_email,
)
return "250 email can't be sent from a reverse-alias"
# unsubscribe request
if UNSUBSCRIBER and rcpt_tos == [UNSUBSCRIBER]:
LOG.d("Handle unsubscribe request from %s", mail_from)