# Unable to receive Emall despite of success message from ansible script

**URL:** <https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493>\
**Category:** Ansible Project\
**Created:** [July 25, 2020, 4:43pm UTC](https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493 "2020-07-25T16:43:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samir\_Kothawade](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@Samir\_Kothawade](https://forum.ansible.com/u/Samir_Kothawade)\
**Post date:** [July 25, 2020, 4:43pm UTC](https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493/1 "2020-07-25T16:43:20Z")

</div>

Ansible script:

- hosts: local  
gather\_facts: no  
tasks:
- name: mailing longevity report  
become: true  
mail:  
host: localhost  
port: 25

> **(attachments)**
>
> ![Auto Generated Inline Image 1.png](https://us1.discourse-cdn.com/ansible/original/2X/9/93f530bafe67ff3436ed690bf7779b615ff49e70.png)

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [July 25, 2020, 4:46pm UTC](https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493/2 "2020-07-25T16:46:16Z")

</div>

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

Regards,

---

<div class="post-metadata">

**Author:** ![Samir\_Kothawade](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@Samir\_Kothawade](https://forum.ansible.com/u/Samir_Kothawade)\
**Post date:** [July 25, 2020, 4:50pm UTC](https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493/3 "2020-07-25T16:50:32Z")

</div>

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.

 ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/e/ebeeb8ba937afdb5bc9e51b7cfb8e7138c0c81c0.png)

---

<div class="post-metadata">

**Author:** ![Avinash\_Jadhav](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Avinash\_Jadhav](https://forum.ansible.com/u/Avinash_Jadhav)\
**Post date:** [July 25, 2020, 5:05pm UTC](https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493/4 "2020-07-25T17:05:09Z")

</div>

Hi Samir

Please try this and make necessary changes

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

```auto
- 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)**
>
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/e/ebeeb8ba937afdb5bc9e51b7cfb8e7138c0c81c0.png)

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [July 25, 2020, 5:52pm UTC](https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493/5 "2020-07-25T17:52:27Z")

</div>

If so, what the logs says ?

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

Regards,

> **(attachments)**
>
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/e/ebeeb8ba937afdb5bc9e51b7cfb8e7138c0c81c0.png)

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 25, 2020, 7:50pm UTC](https://forum.ansible.com/t/unable-to-receive-emall-despite-of-success-message-from-ansible-script/33493/6 "2020-07-25T19:50:37Z")

</div>

> Ansible script:
> 
> - hosts: local  
> &nbsp;&nbsp;gather\_facts: no  
> &nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;&nbsp;- name: mailing longevity report  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;become: true  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mail:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;host: localhost  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;port: 25  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from: jane@example.net (Longevity Report)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to: Samir Kothawade \<kothawade.samir@gmail.com\>  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subject: testing mail Longevity Report  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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
