0

i want to send a report to bunch of emails. when i have only one email address it works but when i want to send to multi email addresses it does not send anything.
here is the code in playbook:

  - hosts: localhost
    remote_user: root
    tasks:
    - name: Send e-mail to a bunch of users
      mail:
        host: 1.1.1.1
        port: 222
        username: testuser
        password: 123
        subject: Ansible-report
        body: "hi! this is for test."
        from: test@oh.com
        to:
        - black crystal <b.crystal@oh.com>
        attach:
        - "/tmp/test"
        charset: us-ascii

when i run above i receive email in my inbox. but with this code:

  - hosts: localhost
    remote_user: root
    tasks:
    - name: Send e-mail to a bunch of users
      mail:
        host: 1.1.1.1
        port: 222
        username: testuser
        password: 123
        subject: Ansible-report
        body: "hi! this is for test."
        from: test@oh.com
        to:
        - black crystal <b.crystal@oh.com>
        - dudu salt <d.salt@oh.com>
        - jirjir mir <j.mir@oh.com>
        attach:
        - "/tmp/test"
        charset: us-ascii

i get no email nor the other email addresses. i tested each email address one by one and they worked but i can't have this job repeated for 20 times!
why this happens and how i can fix it?

  • could you please show logs when running playbook with -vvvv? – alexsuslin Jul 8 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.