On 14. juni 2016 08:03, Abhishek Bandari wrote:
*email.yml*
---
  - hosts: localhost
    tasks:
     - name: sending mail
       mail:
         host: "smtp.gmail.com"
         port: 25
         username: "[email protected]"
         password: "xxxxxxxxxxxxx"
         to: "[email protected]"
         subject: "Ansible-report"
         body: "Hello, this is an e-mail. I hope you like it ;-)"

This code is fine...but im getting error like this.......I tried 25,465.587
ports

According to the example in the documentation
https://docs.ansible.com/ansible/mail_module.html#examples
it's port 587.

And that's work for me.


[root@ansible-hyd ~]# ansible-playbook email.yml

PLAY [localhost]
***************************************************************

TASK [setup]
*******************************************************************
ok: [localhost]

TASK [sending mail]
************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"Failed to send mail to server smtp.gmail.com on port 25: [Errno 101]
Network is unreachable", "rc": 1}

Do you get the same message with port 587?
If so, are port 587 open for outgoing connections?

--
Kai Stian Olstad

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/57600ACB.7050805%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to