Yeah, you can send mail from your gmail account using command line.
You have two options here.
Gmail account settings
Tools being used
For Arch Linux:
$ sudo pacman -S msmtp
For Debian, Ubuntu and other Debian derived distributions:
$ sudo apt install -y msmtp
For Fedora, CentOS, Redhat etc:
$ sudo dnf install msmtp
gpg, we are going to encrypt our password. I have a detailed video tutorial on
gpg if you’re interested.
$ gpg -er 'your gpg keyID' -o ~/.gmail-password.gpg -
Now enter the password for your gmail from first step. Once done, enter
Ctrl + D.
Paste this into
~/.msmtprc or if you want
msmtp system wide so any user on this system can use this gmail account to send mails, copy it to
defaults auth on tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile ~/.msmtp.log account myaccount host smtp.gmail.com port 587 from your_gmail_address user your_gmail_address passwordeval "echo $(gpg --batch -q --decrypt ~/.gmail-password.gpg)" account default: myaccount
your_gmail_address with your gmail address.
Send a test mail
We are done now. Just send a test mail now.
$ echo "Just a test mail" | msmtp -a default 'some email address'
Use with mutt
You can use this
msmtp setup with
mutt which is suck less mail client and runs in a terminal.
I have a detailed video tutorial on
Thanks for reading.
29-11-2020 07:32 +0500