Ansible can send mail from Macbook

$ ansible --version

ansible 2.9.13

config file = /Users/user/.ansible.cfg

configured module search path = [‘/Users/user/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]

ansible python module location = /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ansible

executable location = /Library/Frameworks/Python.framework/Versions/3.8/bin/ansible

python version = 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27) [Clang 6.0 (clang-600.0.57)]

I have the following task

Mail the files

  • name: Mail the zip file

mail:

host: smtp.gmail.com

port: 465 # 587 fails as well

secure: starttls # always fails as well

charset: utf-8

username: “{{ user }}”

password: “{{ pw }}”

I didn’t google hard enough. This asks the same question, and the has the answer, which I’v tried successfully.

https://stackoverflow.com/questions/46992908/ansible-smtp-mail-send