Skip to content

Instantly share code, notes, and snippets.

@stevewhitmore
Last active April 23, 2021 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevewhitmore/79a459b414d89869708eaff4282097e2 to your computer and use it in GitHub Desktop.
Save stevewhitmore/79a459b414d89869708eaff4282097e2 to your computer and use it in GitHub Desktop.
To send mail via Gmail SMTP server

Send Email via Gmail SMTP Server

Set up Gmail App Password

https://myaccount.google.com/apppasswords

Note: You will need 2FA activated for this to work

Configure Bash SMTP

sudo apt-get install mutt

vim ~/.muttrc

set from = "<gmail-id>@gmail.com"
set realname = "<Your Name>"
set smtp_url = "smtp://<gmail-id>@smtp.gmail.com:587/"
set smtp_pass = "<smtp password generated in the google link above>"

echo "This is an email body." | mutt -s "This is an email subject" recipient@example.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment