Skip to content

Instantly share code, notes, and snippets.

@sudheerchamarthi
Created May 24, 2017 10:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sudheerchamarthi/2916f5568a5a1056bc7e7881471bc01f to your computer and use it in GitHub Desktop.
Save sudheerchamarthi/2916f5568a5a1056bc7e7881471bc01f to your computer and use it in GitHub Desktop.
This Ansible is to Send an email using Google SMTP credentials
###############################################################
############### PREREQUISITE #################################
## Make Sure that "Access for less secure apps has been turned on" in you Gmail account by following the below link
## LINK: https://myaccount.google.com/lesssecureapps
## If Not your email will not be delivered and you will recieve a Warning Notifcation like "Review blocked sign-in attempt"
---
- name: Sending email
mail:
host: smtp.gmail.com
port: 465
secure: always
username: YOURUSERNAME@gmail.com
password: YOURPASSWORD
from: YOURUSERNAME@gmail.com
to: TO_EMAIL@gmail.com
cc: CC_EMAIL@gmail.com
subject: SUBJECT
body: BODY OF THE EMAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment