forward reply email can only by used by user email

This commit is contained in:
Son NK 2019-12-15 16:50:04 +02:00
parent 46b0872710
commit c5bf95fffe
1 changed files with 9 additions and 0 deletions

View File

@ -215,6 +215,15 @@ class MailHandler:
forward_email = ForwardEmail.get_by(reply_email=reply_email)
alias: str = forward_email.gen_email.email
user_email = forward_email.gen_email.user.email
if envelope.mail_from != user_email:
LOG.error(
f"Reply email can only be used by user email. Actual mail_from: %s. User email %s",
envelope.mail_from,
user_email,
)
return "550 forbidden"
# todo: add DKIM-Signature for custom domain
# remove DKIM-Signature for custom domain
if not alias.endswith(EMAIL_DOMAIN) and msg["DKIM-Signature"]: