notify user if reply from alias is NOT sent from their personal email
This commit is contained in:
parent
539bf56e97
commit
00dac9a95a
|
@ -143,6 +143,31 @@ def send_cannot_create_domain_alias(user, alias, domain):
|
|||
)
|
||||
|
||||
|
||||
def send_reply_alias_must_use_personal_email(user, alias, sender):
|
||||
"""
|
||||
The reply_email can be used only by user personal email.
|
||||
Notify user if it's used by someone else
|
||||
"""
|
||||
send_email(
|
||||
user.email,
|
||||
f"Reply from your alias {alias} only works with your personal email",
|
||||
_render(
|
||||
"reply-must-use-personal-email.txt",
|
||||
name=user.name,
|
||||
alias=alias,
|
||||
sender=sender,
|
||||
user_email=user.email,
|
||||
),
|
||||
_render(
|
||||
"reply-must-use-personal-email.html",
|
||||
name=user.name,
|
||||
alias=alias,
|
||||
sender=sender,
|
||||
user_email=user.email,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def send_email(to_email, subject, plaintext, html):
|
||||
if NOT_SEND_EMAIL:
|
||||
LOG.d(
|
||||
|
|
|
@ -50,6 +50,7 @@ from app.email_utils import (
|
|||
send_cannot_create_directory_alias,
|
||||
send_cannot_create_domain_alias,
|
||||
email_belongs_to_alias_domains,
|
||||
send_reply_alias_must_use_personal_email,
|
||||
)
|
||||
from app.extensions import db
|
||||
from app.log import LOG
|
||||
|
@ -301,6 +302,12 @@ class MailHandler:
|
|||
reply_email,
|
||||
)
|
||||
|
||||
send_reply_alias_must_use_personal_email(
|
||||
forward_email.gen_email.user,
|
||||
forward_email.gen_email.email,
|
||||
envelope.mail_from,
|
||||
)
|
||||
|
||||
send_email(
|
||||
envelope.mail_from,
|
||||
f"Your email ({envelope.mail_from}) is not allowed to send email to {reply_email}",
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
Hi {{name}} <br><br>
|
||||
|
||||
We have recorded an attempt to reply from your alias <b>{{ alias }}</b> from <b>{{ sender }}</b>. <br><br>
|
||||
|
||||
Please note that reply from alias only works from your personal email ({{user_email}}): no one else could reply on behalf of your alias. <br><br>
|
||||
|
||||
Best, <br>
|
||||
SimpleLogin team.
|
|
@ -0,0 +1,8 @@
|
|||
Hi {{name}}
|
||||
|
||||
We have recorded an attempt to reply from your alias {{ alias }} from {{ sender }}.
|
||||
|
||||
Please note that reply from alias only works from your personal email ({{user_email}}): no one else could reply on behalf of your alias.
|
||||
|
||||
Best,
|
||||
SimpleLogin team.
|
Loading…
Reference in New Issue