fix case sensitivity bug in mail domain lookup

This commit is contained in:
j3d1 2023-12-30 01:46:49 +01:00
parent b4687a8821
commit 68812fe6b9

View file

@ -93,6 +93,7 @@ def find_active_issue_thread(in_reply_to, subject=None):
class LMTPHandler:
async def handle_RCPT(self, server, session, envelope, address, rcpt_options):
from core.settings import MAIL_DOMAIN
address = address.lower()
if not address.endswith('@' + MAIL_DOMAIN):
return '550 not relaying to that domain'
envelope.rcpt_tos.append(address)
@ -136,7 +137,7 @@ class LMTPHandler:
log.warning("Header to does not match envelope to")
log.info(f"Header to: {header_to}, envelope to: {envelope.rcpt_tos[0]}")
recipient = envelope.rcpt_tos[0]
recipient = envelope.rcpt_tos[0].lower()
sender = envelope.mail_from
subject = parsed.get('Subject')
subject = unescape_and_decode_quoted_printable(subject)
@ -168,8 +169,6 @@ class LMTPHandler:
)
log.info(f"Sent message to frontend")
if new:
await sync_to_async(StateChange.objects.create)(issue_thread=active_issue_thread, state='new')
references = await sync_to_async(collect_references)(active_issue_thread)
reply_email = await sync_to_async(Email.objects.create)(