Bladeren bron

Separate if statements for starttls() and login() calls

guillaume chanaud 7 jaren geleden
bovenliggende
commit
4651cacc46
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7 1
      tracim/tracim/lib/email.py

+ 7 - 1
tracim/tracim/lib/email.py Bestand weergeven

@@ -73,10 +73,16 @@ class EmailSender(object):
73 73
                 try:
74 74
                     starttls_result = self._smtp_connection.starttls()
75 75
                     logger.debug(self, 'SMTP start TLS result: {}'.format(starttls_result))
76
+                except Exception as e:
77
+                    logger.debug(self, 'SMTP start TLS error: {}'.format(e.__str__()))
78
+                    
79
+            if self._smtp_config.login:
80
+                try:
76 81
                     login_res = self._smtp_connection.login(self._smtp_config.login, self._smtp_config.password)
77 82
                     logger.debug(self, 'SMTP login result: {}'.format(login_res))
78 83
                 except Exception as e:
79
-                    logger.debug(self, 'SMTP start TLS error: {}'.format(e.__str__()))
84
+                    logger.debug(self, 'SMTP login error: {}'.format(e.__str__()))
85
+                
80 86
             logger.info(self, 'Connection OK')
81 87
 
82 88
     def disconnect(self):