stash
This commit is contained in:
parent
83299bba7a
commit
dbbd63ab1e
1 changed files with 10 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
from re import match
|
||||
|
||||
import aiosmtplib
|
||||
from channels.layers import get_channel_layer
|
||||
|
@ -201,17 +202,17 @@ def receive_email(envelope, log=None):
|
|||
header_in_reply_to = parsed.get('In-Reply-To')
|
||||
header_message_id = parsed.get('Message-ID')
|
||||
|
||||
if header_from != envelope.mail_from:
|
||||
log.warning("Header from does not match envelope from")
|
||||
log.info(f"Header from: {header_from}, envelope from: {envelope.mail_from}")
|
||||
# if header_from != envelope.mail_from:
|
||||
# log.warning("Header from does not match envelope from")
|
||||
# log.info(f"Header from: {header_from}, envelope from: {envelope.mail_from}")
|
||||
#
|
||||
# if header_to != envelope.rcpt_tos[0]:
|
||||
# log.warning("Header to does not match envelope to")
|
||||
# log.info(f"Header to: {header_to}, envelope to: {envelope.rcpt_tos[0]}")
|
||||
|
||||
if header_to != envelope.rcpt_tos[0]:
|
||||
log.warning("Header to does not match envelope to")
|
||||
log.info(f"Header to: {header_to}, envelope to: {envelope.rcpt_tos[0]}")
|
||||
# handle undelivered mail header_from : 'Mail Delivery System <MAILER-DAEMON@...'
|
||||
|
||||
# handle undelivered mail 'MAILER-DAEMON@'
|
||||
|
||||
if header_from.strip("<>").startswith('MAILER-DAEMON@') and envelope.mail_from.strip("<>") == "":
|
||||
if match(r'^[a-zA-Z ]*<?MAILER-DAEMON@', header_from) and envelope.mail_from.strip("<>") == "":
|
||||
log.warning("Ignoring mailer daemon")
|
||||
raise SpecialMailException("Ignoring mailer daemon")
|
||||
|
||||
|
|
Loading…
Reference in a new issue