Unable to receive Emall despite of success message from ansible script

29 views
Skip to first unread message

Samir Kothawade

unread,
Jul 25, 2020, 12:43:21 PM7/25/20
to Ansible Project
Ansible script:

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


Output observed after running above script:




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.

Jean-Yves LENHOF

unread,
Jul 25, 2020, 12:46:30 PM7/25/20
to ansible...@googlegroups.com

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

Regards,

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/08204b07-6128-416c-b89d-6dcddd41f0d2o%40googlegroups.com.

Samir Kothawade

unread,
Jul 25, 2020, 12:51:02 PM7/25/20
to ansible...@googlegroups.com
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

Avinash Jadhav

unread,
Jul 25, 2020, 1:05:50 PM7/25/20
to ansible...@googlegroups.com
Hi Samir

Please try this and make necessary changes 

- hosts:
    - localhost
  tasks:
    - name: Sending an e-mail using Gmail SMTP servers
      mail:
        host: smtp.gmail.com
        port: 587
        username: user...@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

Jean-Yves LENHOF

unread,
Jul 25, 2020, 1:52:46 PM7/25/20
to ansible...@googlegroups.com

If so, what the logs says ?

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

Regards,

Dick Visser

unread,
Jul 25, 2020, 3:51:09 PM7/25/20
to ansible...@googlegroups.com
On Sat, 25 Jul 2020 at 18:43, Samir Kothawade <kothawa...@gmail.com> wrote:
>
> Ansible script:
>
> - hosts: local
> gather_facts: no
> tasks:
> - name: mailing longevity report
> become: true
> mail:
> host: localhost
> port: 25
> from: ja...@example.net (Longevity Report)
> to: Samir Kothawade <kothawa...@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
Reply all
Reply to author
Forward
0 new messages