title: How to send an email with Ansible
body: <p>I'm trying to send an email using Ansible, but I can't understand how it works as I don't know how to provide user and password for such service (not specified in the <a href="http://docs.ansible.com/mail_module.html" rel="noreferrer">documentation</a>).</p>
  
  <p>Both my machine and the email server are in the same network, but I need to be authenticated in order to send the email.</p>
  
  <p>This is my yml file:</p>
  
  <pre><code>--- 
  - name: Testing email
    hosts: localhost
    tasks: 
      - name: Send email
        local_action: mail
          host=mail.server.com
          port=993
          subject="Ansible test mail"
          body="Testing email"
          from=my@email
          to="y@email
          charset=utf8
  </code></pre>
  
  <p>And this is the related content of the hosts' file:</p>
  
  <pre><code>[localhost]
  localhost ansible_connection=local
  </code></pre>
  
  <p>Any idea about how should I configure it? Thanks in advance.</p>