Skip to content

Commit 9d06192

Browse files
authored
Merge pull request #318 from itkovian/fix-mail-connect
Fix mail connect
2 parents 421e4b4 + 41e97d0 commit 9d06192

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/vsc/utils/mail.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ def _connect(self):
100100
s.login(user=self.smtp_auth_user, password=self.smtp_auth_password)
101101
logging.debug("Authenticated")
102102

103-
s.connect()
104-
105103
return s
106104

107105
def _send(self, mail_from, mail_to, mail_subject, msg):
@@ -119,15 +117,16 @@ def _send(self, mail_from, mail_to, mail_subject, msg):
119117
try:
120118
s.sendmail(mail_from, mail_to, msg.as_string())
121119
except smtplib.SMTPHeloError as err:
122-
logging.error("Cannot get a proper response from the SMTP host %s", self.mail_host)
120+
logging.error("Cannot get a proper response from the SMTP host %s: %s", self.mail_host, err)
123121
raise
124122
except smtplib.SMTPRecipientsRefused as err:
125-
logging.error("All recipients were refused by SMTP host %s [%s]", self.mail_host, mail_to)
123+
logging.error("All recipients were refused by SMTP host %s [%s]: %s", self.mail_host, mail_to, err)
126124
raise
127125
except smtplib.SMTPSenderRefused as err:
128-
logging.error("Sender was refused by SMTP host %s [%s]", self.mail_host, mail_from)
126+
logging.error("Sender was refused by SMTP host %s [%s]: %s", self.mail_host, mail_from, err)
129127
raise
130128
except smtplib.SMTPDataError as err:
129+
logging.error("Data error: %s", err)
131130
raise
132131

133132
except smtplib.SMTPConnectError as err:

lib/vsc/utils/missing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ def new_function(*args, **kwargs):
318318
logging.warning("try_or_fail is sleeping for %d seconds before the next attempt", self.sleep)
319319
time.sleep(self.sleep)
320320

321+
return None
322+
321323
return new_function
322324

323325

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
]
4545

4646
PACKAGE = {
47-
'version': '3.3.1',
47+
'version': '3.3.2',
4848
'author': [sdw, jt, ag, kh],
4949
'maintainer': [sdw, jt, ag, kh],
5050
# as long as 1.0.0 is not out, vsc-base should still provide vsc.fancylogger

0 commit comments

Comments
 (0)