stash
This commit is contained in:
parent
381ecda1ce
commit
f9830affea
1 changed files with 10 additions and 3 deletions
|
@ -11,6 +11,10 @@ from notify_sessions.models import SystemEvent
|
||||||
from tickets.models import IssueThread
|
from tickets.models import IssueThread
|
||||||
|
|
||||||
|
|
||||||
|
class SpecialMailException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def find_quoted_printable(s, marker):
|
def find_quoted_printable(s, marker):
|
||||||
positions = [i for i in range(len(s)) if s.lower().startswith('=?utf-8?' + marker + '?', i)]
|
positions = [i for i in range(len(s)) if s.lower().startswith('=?utf-8?' + marker + '?', i)]
|
||||||
for pos in positions:
|
for pos in positions:
|
||||||
|
@ -207,9 +211,9 @@ def receive_email(envelope, log=None):
|
||||||
|
|
||||||
# handle undelivered mail 'MAILER-DAEMON@'
|
# handle undelivered mail 'MAILER-DAEMON@'
|
||||||
|
|
||||||
#if header_from.startswith('MAILER-DAEMON@'):
|
if header_from.trim("<>").startswith('MAILER-DAEMON@') and envelope.mail_from.trim("<>") == "":
|
||||||
# log.warning("Mail delivery failed")
|
log.warning("Ignoring mailer daemon")
|
||||||
# return None, False, None, None
|
raise SpecialMailException("Ignoring mailer daemon")
|
||||||
|
|
||||||
if Email.objects.filter(reference=header_message_id).exists(): # break before issue thread is created
|
if Email.objects.filter(reference=header_message_id).exists(): # break before issue thread is created
|
||||||
log.warning("Email already exists")
|
log.warning("Email already exists")
|
||||||
|
@ -292,6 +296,9 @@ class LMTPHandler:
|
||||||
await send_smtp(reply)
|
await send_smtp(reply)
|
||||||
log.info("Sent auto reply")
|
log.info("Sent auto reply")
|
||||||
|
|
||||||
|
return '250 Message accepted for delivery'
|
||||||
|
except SpecialMailException as e:
|
||||||
|
log.warning(f"Special mail exception: {e}")
|
||||||
return '250 Message accepted for delivery'
|
return '250 Message accepted for delivery'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
|
|
Loading…
Reference in a new issue