Generate an App password for your Google account. Select the custom option from the drop-down menu. The password will work with any of the utilities below.
-
Install sendemail and dependencies
sudo apt install libio-socket-ssl-perl libnet-ssleay-perl libterm-readkey-perl sendemail
-
Apply patch1 to simplify the mailing experience
sudo patch /usr/bin/sendEmail < sendEmail-1.56-5.patch
-
Apply patch2 to add some colored confirmation when mail is sent
sudo patch /usr/bin/sendEmail < sendEmail-1.56-5_color.patch
-
Add the following alias in your shell's rc file
alias mail='sendemail -f [email protected] -s smtp.gmail.com:587 -o tls=yes -xu yourmail -t '
-
Send a mail with 2 attachments
mail [email protected] -a attachment1.pdf attachment2.mp3
-
Install ssmtp
sudo apt install ssmtp
-
Configure ssmtp (
/etc/ssmtp/ssmtp.conf
)
[email protected]
mailhub=smtp.gmail.com:465
FromLineOverride=YES
[email protected]
AuthPass=generated_app_password
UseTLS=YES
- Send mails from the cmdline
mpack -s "sub: attachment" attachment_file [email protected]