do not send an auto reply to 'noreply*' addresses

This commit is contained in:
j3d1 2024-01-12 20:58:37 +01:00
parent 1804939407
commit c79b3185e5
3 changed files with 38 additions and 9 deletions

View file

@ -182,11 +182,11 @@ def receive_email(envelope, log=None):
if new:
# auto reply if new issue
references = collect_references(active_issue_thread)
reply_email = Email.objects.create(
sender=recipient, recipient=sender, body="Thank you for your message.", subject="Message received",
in_reply_to=header_message_id, event=target_event, issue_thread=active_issue_thread)
reply = make_reply(reply_email, references)
if not sender.startswith('noreply'):
reply_email = Email.objects.create(
sender=recipient, recipient=sender, body="Thank you for your message.", subject="Message received",
in_reply_to=header_message_id, event=target_event, issue_thread=active_issue_thread)
reply = make_reply(reply_email, references)
else:
# change state if not new
if active_issue_thread.state != 'pending_new':
@ -223,7 +223,7 @@ class LMTPHandler:
"message": "email received"}
)
log.info(f"Sent message to frontend")
if new:
if new and reply:
await send_smtp(reply, log)
log.info("Sent auto reply")