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
This commit is contained in:
parent
0e933f76ba
commit
44ae37d78b
2 changed files with 4 additions and 0 deletions
2
changelogs/fragments/mail-fix-regression.yaml
Normal file
2
changelogs/fragments/mail-fix-regression.yaml
Normal file
|
@ -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…
Reference in a new issue