mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-26 08:26:28 +00:00
mail: fixed STARTTLS module working with python 3.7.0 (#47412)
This commit is contained in:
committed by
Brian Coca
parent
d7686e1bc0
commit
8c9070ec05
@@ -264,8 +264,8 @@ def main():
|
||||
try:
|
||||
if secure != 'never':
|
||||
try:
|
||||
smtp = smtplib.SMTP_SSL(host=host, timeout=timeout)
|
||||
code, smtpmessage = smtp.connect(host, port=port)
|
||||
smtp = smtplib.SMTP_SSL(host=host, port=port, timeout=timeout)
|
||||
code, smtpmessage = smtp.connect(host, port)
|
||||
secure_state = True
|
||||
except ssl.SSLError as e:
|
||||
if secure == 'always':
|
||||
@@ -275,8 +275,8 @@ def main():
|
||||
pass
|
||||
|
||||
if not secure_state:
|
||||
smtp = smtplib.SMTP(timeout=timeout)
|
||||
code, smtpmessage = smtp.connect(host, port=port)
|
||||
smtp = smtplib.SMTP(host=host, port=port, timeout=timeout)
|
||||
code, smtpmessage = smtp.connect(host, port)
|
||||
|
||||
except smtplib.SMTPException as e:
|
||||
module.fail_json(rc=1, msg='Unable to Connect %s:%s: %s' % (host, port, to_native(e)), exception=traceback.format_exc())
|
||||
|
||||
Reference in New Issue
Block a user