Unable to receive Emall despite of success message from ansible script

Ansible script:

  • hosts: local
    gather_facts: no
    tasks:
  • name: mailing longevity report
    become: true
    mail:
    host: localhost
    port: 25
(attachments)

Look at your logs mail server(the one which answer on tcp port 25) if there’s something interesting in it…

Regards,

Yes it is. Actually I took the reference of an ansible documentation site for this writing above script. Here is the ref. screenshot from ansible documentation.

Hi Samir

Please try this and make necessary changes

https://github.com/infinitypp/ansible-mail-module-examples/blob/master/tasks/main.yml

- hosts:
    - localhost
  tasks:
    - name: Sending an e-mail using Gmail SMTP servers
      mail:
        host: [smtp.gmail.com](http://smtp.gmail.com)
        port: 587
        username: [username@gmail.com](mailto:username@gmail.com)
        password: your-password
        to: recipient-name <recipient-email@domain>
        subject: Ansible Report
        body: System [[ ansible_hostname ]] has been successfully provisioned.
      delegate_to: localhost
(attachments)

If so, what the logs says ?

I’m not sure you understand what is daemon listening on port 25 ?

Regards,

(attachments)

Ansible script:

- hosts: local
  gather_facts: no
  tasks:
   - name: mailing longevity report
     become: true
     mail:
        host: localhost
        port: 25
        from: jane@example.net (Longevity Report)
        to: Samir Kothawade <kothawade.samir@gmail.com>
        subject: testing mail Longevity Report
        body: hi this is testing mail

Output observed after running above script:

Hii

Please post actual text output instead of unreadable screen dumps.

I am not receiving emails after running above command despite if success message from above script. Note -My network connectivity is good and reachable to gmail as well.
Can someone help me out with this.

The playbook is about *sending* mail. That went perfectly fine as you
can see from the output.
The *receiving* part is something different, there can be many reasons
why this didn't work. You need to look into the systems that are
involved further down the line.
Your local SMTP server will be a good place to start looking, but that
is off-topic for this list.

DIck