Skip to content

Instantly share code, notes, and snippets.

@heisvoid
Last active July 16, 2022 06:39
S-nail $HOME/.mailrc for Gmail
# You should replace USER and PASSWORD.
# PASSWORD is plain text. So you should set appropriate permissions with chmod 0600.
account gmail {
set v15-compat
set mta=smtp://USER:PASSWORD@smtp.gmail.com:587 smtp-use-starttls
}
@heisvoid
Copy link
Author

The following command is a example to send a mail to foo@bar.com. "-vv" is optional for verbosity.
$ echo testbody | mailx -vv -A gmail -s testsubject foo@bar.com

@heisvoid
Copy link
Author

Currently, PASSWORD should be 'App Password'. Google account password does not work.
The followings show how to setup App Password.
https://web.archive.org/web/20220716063430/https://docs.3rdeyesys.com/etc/etc_smtp_auth_to_google_gmail_account.html
https://archive.ph/KNMr5

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