mirror of
https://github.com/simple-login/app.git
synced 2024-09-28 20:51:29 +02:00
Handle SMTPRecipientsRefused in send_email
This commit is contained in:
parent
b05daecd28
commit
1c5c5896f8
@ -15,6 +15,7 @@ from app.log import LOG
|
||||
from app.models import GenEmail, DeletedAlias
|
||||
from app.models import Mailbox
|
||||
from app.pgp_utils import PGPException, load_public_key
|
||||
from smtplib import SMTPRecipientsRefused
|
||||
|
||||
|
||||
class ChangeEmailForm(FlaskForm):
|
||||
@ -68,6 +69,7 @@ def mailbox_detail_route(mailbox_id):
|
||||
+ f"?mailbox_id={mailbox_id_signed}"
|
||||
)
|
||||
|
||||
try:
|
||||
send_email(
|
||||
new_email,
|
||||
f"Confirm mailbox change on SimpleLogin",
|
||||
@ -86,7 +88,12 @@ def mailbox_detail_route(mailbox_id):
|
||||
mailbox_new_email=new_email,
|
||||
),
|
||||
)
|
||||
|
||||
except SMTPRecipientsRefused:
|
||||
flash(
|
||||
f"Incorrect mailbox, please recheck {mailbox.email}",
|
||||
"error",
|
||||
)
|
||||
else:
|
||||
flash(
|
||||
f"You are going to receive an email to confirm {new_email}.",
|
||||
"success",
|
||||
|
Loading…
Reference in New Issue
Block a user