Merge pull request #22 from evidencebp/main
Pylint alerts corrections as part of an intervention experiment 21 (src\stacosys\service\mail.py broad-exception-caught)
This commit is contained in:
commit
0d144a683f
1 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from smtplib import SMTP_SSL, SMTPAuthenticationError
|
from smtplib import SMTP_SSL, SMTPAuthenticationError, SMTPException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -54,6 +54,6 @@ class Mailer:
|
||||||
|
|
||||||
server.send_message(msg)
|
server.send_message(msg)
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except SMTPException:
|
||||||
logger.error("Error sending email", exc_info=True)
|
logger.error("Error sending email", exc_info=True)
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Add table
Reference in a new issue