mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 15:23:27 +08:00
use mailbox_email when notifying user attempt to send from his alias
This commit is contained in:
parent
d1241c6e18
commit
b41a61165c
5 changed files with 22 additions and 32 deletions
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -130,6 +130,7 @@ def fake_data():
|
|||
activated=True,
|
||||
is_admin=True,
|
||||
otp_secret="base32secret3232",
|
||||
can_use_multiple_mailbox=True,
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Hi {{name}} <br><br>
|
|||
|
||||
We have recorded an attempt to send an email from your alias <b>{{ alias }}</b> using <b>{{ sender }}</b>. <br><br>
|
||||
|
||||
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. <br><br>
|
||||
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. <br><br>
|
||||
|
||||
Best, <br>
|
||||
SimpleLogin team.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue