File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 5.12.12
4+
5+ - Do not attempt to include an SMTP error code when none is provided (Close #189 )
6+
37## 5.12.11
48
59- Remove unneeded ` finally ` blocks in ` smtp.py ` that were causing warnings in Python 3.14 (Close #178 )
Original file line number Diff line number Diff line change 1919See the License for the specific language governing permissions and
2020limitations under the License."""
2121
22- __version__ = "5.12.11 "
22+ __version__ = "5.12.12 "
2323
2424OS = platform .system ()
2525OS_RELEASE = platform .release ()
Original file line number Diff line number Diff line change @@ -181,8 +181,11 @@ def test_tls(
181181 raise SMTPError (error )
182182 except smtplib .SMTPException as e :
183183 error = e .__str__ ()
184- error_code = error .lstrip ("(" ).split ("," )[0 ]
185- error = f"SMTP error code { error_code } "
184+ try :
185+ error_code = error .lstrip ("(" ).split ("," )[0 ]
186+ error = f"SMTP error code { error_code } "
187+ except ValueError :
188+ pass
186189 if cache :
187190 cache [hostname ] = dict (tls = False , error = error )
188191 raise SMTPError (error )
@@ -300,9 +303,12 @@ def test_starttls(
300303 cache [hostname ] = dict (starttls = False , error = error )
301304 raise SMTPError (error )
302305 except smtplib .SMTPException as e :
303- message = e .__str__ ()
304- error_code = int (message .lstrip ("(" ).split ("," )[0 ])
305- error = f"SMTP error code { error_code } "
306+ error = e .__str__ ()
307+ try :
308+ error_code = error .lstrip ("(" ).split ("," )[0 ]
309+ error = f"SMTP error code { error_code } "
310+ except ValueError :
311+ pass
306312 if cache :
307313 cache [hostname ] = dict (starttls = False , error = error )
308314 raise SMTPError (error )
You can’t perform that action at this time.
0 commit comments