use postfix retry for SMTPServerDisconnected (in addition to SMTPRecipientsRefused) error
This commit is contained in:
parent
584772f798
commit
f0e582c1a6
|
@ -42,7 +42,7 @@ from email.mime.application import MIMEApplication
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.utils import formataddr, make_msgid, formatdate, getaddresses
|
from email.utils import formataddr, make_msgid, formatdate, getaddresses
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from smtplib import SMTPRecipientsRefused
|
from smtplib import SMTPRecipientsRefused, SMTPServerDisconnected
|
||||||
from typing import List, Tuple, Optional
|
from typing import List, Tuple, Optional
|
||||||
|
|
||||||
import newrelic.agent
|
import newrelic.agent
|
||||||
|
@ -824,13 +824,14 @@ def forward_email_to_mailbox(
|
||||||
envelope.rcpt_options,
|
envelope.rcpt_options,
|
||||||
is_forward=True,
|
is_forward=True,
|
||||||
)
|
)
|
||||||
except SMTPRecipientsRefused:
|
except (SMTPServerDisconnected, SMTPRecipientsRefused):
|
||||||
# that means the mailbox is maybe invalid
|
# that means the mailbox is maybe invalid
|
||||||
LOG.w(
|
LOG.w(
|
||||||
"SMTPRecipientsRefused forward phase %s -> %s -> %s",
|
"SMTPServerDisconnected or SMTPRecipientsRefused during forward phase %s -> %s -> %s",
|
||||||
contact,
|
contact,
|
||||||
alias,
|
alias,
|
||||||
mailbox,
|
mailbox,
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
if should_ignore_bounce(envelope.mail_from):
|
if should_ignore_bounce(envelope.mail_from):
|
||||||
return True, status.E207
|
return True, status.E207
|
||||||
|
|
Loading…
Reference in a new issue