Link to wiki: https://wiki.archlinux.org/index.php/msmtp
sudo pacman -S msmtp msmtp-mta
Edit /etc/msmtprc
as in the wiki page. If using gmail account, generate an app password at the page https://security.google.com/settings/u/1/security/apppasswords and use that one instead of the real password.