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