mirror of
https://github.com/simple-login/app.git
synced 2024-09-29 05:01: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 GenEmail, DeletedAlias
|
||||||
from app.models import Mailbox
|
from app.models import Mailbox
|
||||||
from app.pgp_utils import PGPException, load_public_key
|
from app.pgp_utils import PGPException, load_public_key
|
||||||
|
from smtplib import SMTPRecipientsRefused
|
||||||
|
|
||||||
|
|
||||||
class ChangeEmailForm(FlaskForm):
|
class ChangeEmailForm(FlaskForm):
|
||||||
@ -68,6 +69,7 @@ def mailbox_detail_route(mailbox_id):
|
|||||||
+ f"?mailbox_id={mailbox_id_signed}"
|
+ f"?mailbox_id={mailbox_id_signed}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
send_email(
|
send_email(
|
||||||
new_email,
|
new_email,
|
||||||
f"Confirm mailbox change on SimpleLogin",
|
f"Confirm mailbox change on SimpleLogin",
|
||||||
@ -86,7 +88,12 @@ def mailbox_detail_route(mailbox_id):
|
|||||||
mailbox_new_email=new_email,
|
mailbox_new_email=new_email,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
except SMTPRecipientsRefused:
|
||||||
|
flash(
|
||||||
|
f"Incorrect mailbox, please recheck {mailbox.email}",
|
||||||
|
"error",
|
||||||
|
)
|
||||||
|
else:
|
||||||
flash(
|
flash(
|
||||||
f"You are going to receive an email to confirm {new_email}.",
|
f"You are going to receive an email to confirm {new_email}.",
|
||||||
"success",
|
"success",
|
||||||
|
Loading…
Reference in New Issue
Block a user