mail: Fix regression when sending mail without SSL (v2.7) (#47019)

* mail: Fix regression when sending mail without SSL (v2.7)

When this module was refactored in #37098 the non-SSL use-case was broken.

The main cause is that we have no way to do integration tests for testing SMTP.

This is a back-port to v2.7 of #46403

* Add changelog fragment
pull/47463/head
Dag Wieers 7 years ago committed by Toshio Kuratomi
parent 0e933f76ba
commit 44ae37d78b

@ -0,0 +1,2 @@
bugfixes:
- mail - Fix regression when sending mail without TLS/SSL

@ -255,6 +255,8 @@ def main():
if secure == 'always':
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' %
(host, port, to_native(e)), exception=traceback.format_exc())
except:
pass
if not secure_state:
smtp = smtplib.SMTP(timeout=timeout)

Loading…
Cancel
Save