Reply only once per user even if they send it from any mailbox
This commit is contained in:
parent
b0ac2f871a
commit
b069f81920
|
@ -2080,17 +2080,18 @@ def should_ignore(mail_from: str, rcpt_tos: List[str]) -> bool:
|
|||
|
||||
|
||||
def send_no_reply_response(mail_from: str, msg: Message):
|
||||
user = User.get_by(email=mail_from)
|
||||
if user:
|
||||
send_email_at_most_times(
|
||||
user,
|
||||
ALERT_TO_NOREPLY,
|
||||
user.email,
|
||||
"Auto: {}".format(msg[headers.SUBJECT] or "No subject"),
|
||||
render("transactional/noreply.text.jinja2"),
|
||||
)
|
||||
else:
|
||||
mailbox = Mailbox.get_by(email=mail_from)
|
||||
user = User.get(mailbox.user_id)
|
||||
if not user:
|
||||
LOG.d("Unknown sender. Skipping reply from {}".format(NOREPLY))
|
||||
return
|
||||
send_email_at_most_times(
|
||||
user,
|
||||
ALERT_TO_NOREPLY,
|
||||
user.email,
|
||||
"Auto: {}".format(msg[headers.SUBJECT] or "No subject"),
|
||||
render("transactional/noreply.text.jinja2"),
|
||||
)
|
||||
|
||||
|
||||
def handle(envelope: Envelope, msg: Message) -> str:
|
||||
|
|
Loading…
Reference in New Issue