# need to send mail using attachment and password encryption

**URL:** <https://forum.ansible.com/t/need-to-send-mail-using-attachment-and-password-encryption/29160>\
**Category:** Ansible Project\
**Created:** [November 30, 2018, 10:01am UTC](https://forum.ansible.com/t/need-to-send-mail-using-attachment-and-password-encryption/29160 "2018-11-30T10:01:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek1](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vivek1](https://forum.ansible.com/u/Vivek1)\
**Post date:** [November 30, 2018, 10:01am UTC](https://forum.ansible.com/t/need-to-send-mail-using-attachment-and-password-encryption/29160/1 "2018-11-30T10:01:43Z")

</div>

Hi Experts,

I am facing issue with by below playbook on 2 scenarios

1. How to send mails using ansible without defining the password of the account. using SMTP username and password now in the play to send mail. but is there any alternate way to avoid specifying password or using the encryption for password.

`

- name: Send email  
mail:  
host: [smtpserver.com](http://smtpserver.com)  
port: 25  
username: mydomainID  
password: mypass  
attach: /opt/IBM/605CLM/JazzTeamserver/server/liberty/servers/clm/logs/jts.log  
body: “Testing email”  
to:
- [mymailid.com](http://mymailid.com)  
charset: utf8  
secure: never  
`

1. Lokking for a way to attach the log file in the mail after starting the application. but it failing… any advise please.
