Notify user cycle email (#1035)

* notify user about a cycle email

* prettify notification detail page
This commit is contained in:
Son Nguyen Kim 2022-06-07 16:44:57 +02:00 committed by GitHub
parent e688f04d6b
commit 84fcc9ddc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 3 deletions

View File

@ -550,6 +550,18 @@ def handle_email_sent_to_ourself(alias, from_addr: str, msg: Message, user):
# link available for 6 days as it gets deleted in 7 days
refused_email_url = refused_email.get_url(expires_in=518400)
Notification.create(
user_id=user.id,
title=f"Email sent to {alias.email} from its own mailbox {from_addr}",
message=Notification.render(
"notification/cycle-email.html",
alias=alias,
from_addr=from_addr,
refused_email_url=refused_email_url,
),
commit=True,
)
send_email_at_most_times(
user,
ALERT_SEND_EMAIL_CYCLE,

View File

@ -18,9 +18,8 @@
{{ notification.message | safe }}
</div>
<hr>
<form method="post" class="mt-3" onsubmit="return confirm('This operation is not reversible, please confirm');">
<form method="post" class="float-right mt-3"
onsubmit="return confirm('This operation is not reversible, please confirm');">
<button class="btn btn-outline-danger">Delete</button>
</form>
</div>

View File

@ -0,0 +1,10 @@
<div>
An email was sent to your alias <b>{{ alias.email }}</b> from its own mailbox <b>{{ from_addr }}</b>.
</div>
<div>
SimpleLogin doesn't send this email back to your mailbox as it would be refused or hidden anyway by your email
service.
</div>
<div>
So no worries, there's nothing you need to do :).
</div>