diff --git a/app/email_utils.py b/app/email_utils.py index d4ad481a..096ce13d 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -167,31 +167,6 @@ 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( - "transactional/reply-must-use-personal-email.txt", - name=user.name, - alias=alias, - sender=sender, - user_email=user.email, - ), - render( - "transactional/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( diff --git a/email_handler.py b/email_handler.py index 672adbeb..afe66159 100644 --- a/email_handler.py +++ b/email_handler.py @@ -50,7 +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, + render, ) from app.extensions import db from app.log import LOG @@ -328,10 +328,24 @@ class MailHandler: reply_email, ) - send_reply_alias_must_use_personal_email( - forward_email.gen_email.user, - forward_email.gen_email.email, - envelope.mail_from, + user = gen_email.user + send_email( + mailbox_email, + f"Reply from your alias {alias} only works from your mailbox", + render( + "transactional/reply-must-use-personal-email.txt", + name=user.name, + alias=alias, + sender=envelope.mail_from, + mailbox_email=mailbox_email, + ), + render( + "transactional/reply-must-use-personal-email.html", + name=user.name, + alias=alias, + sender=envelope.mail_from, + mailbox_email=mailbox_email, + ), ) send_email( diff --git a/server.py b/server.py index 00817908..c07aa465 100644 --- a/server.py +++ b/server.py @@ -130,6 +130,7 @@ def fake_data(): activated=True, is_admin=True, otp_secret="base32secret3232", + can_use_multiple_mailbox=True, ) db.session.commit() diff --git a/templates/emails/transactional/reply-must-use-personal-email.html b/templates/emails/transactional/reply-must-use-personal-email.html index 007f658e..ed237c01 100644 --- a/templates/emails/transactional/reply-must-use-personal-email.html +++ b/templates/emails/transactional/reply-must-use-personal-email.html @@ -2,7 +2,7 @@ Hi {{name}}

We have recorded an attempt to send an email from your alias {{ alias }} using {{ sender }}.

-Please note that sending from alias only works from your personal email ({{user_email}}): no one else could send emails on behalf of your alias.

+Please note that sending from alias only works from {{mailbox_email}}: only you (i.e. no one else) can send emails on behalf of your alias.

Best,
SimpleLogin team. diff --git a/templates/emails/transactional/reply-must-use-personal-email.txt b/templates/emails/transactional/reply-must-use-personal-email.txt index ac6fb2da..1ee52f1f 100644 --- a/templates/emails/transactional/reply-must-use-personal-email.txt +++ b/templates/emails/transactional/reply-must-use-personal-email.txt @@ -2,7 +2,7 @@ Hi {{name}} We have recorded an attempt to send an email from your alias {{ alias }} using {{ sender }}. -Please note that sending from alias only works from your personal email ({{user_email}}): no one else could send emails on behalf of your alias. +Please note that sending from this alias only works from {{mailbox_email}}: only you (i.e. no one else) can send emails on behalf of your alias. Best, SimpleLogin team.