@@ -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 :
0 commit comments