This illustrates how to setup mutt so that it sends email from a Google Apps gmail account. Alternately, you can just use a Gmail regular account.
First install mutt:
On Debian:
apt-get install mutt
Now, create a folder for mutt:
mkdir -p /.mutt/cache
Now, edit ~/.muttrc file (it may not exist):
emacs ~/.muttrc
It should have the following contents:
account-hook imap://gmail/ “set set from = "[email protected]" set realname = "Server Mailer" set imap_user = "[email protected]" set imap_pass = "Be4!testpass" set folder = "imaps://imap.gmail.com:993" set spoolfile = "+INBOX" set postponed ="+[Gmail]/Drafts" set header_cache =~/.mutt/cache/headers set message_cachedir =~/.mutt/cache/bodies set certificate_file =~/.mutt/certificates set smtp_url = "smtp://[email protected]@smtp.gmail.com:587/" set smtp_pass = "Be4!testpass" set move = no set imap_keepalive = 900
In the above example mutt configuration file, I had already created a Google Apps Mail account [email protected], with the password “Be4!testpass”. Of course you should set a more complex password.
Create a test message:
emacs /tmp/message.txt
TResting Pot Got
Now try sending a mail to yourself to test:
mutt -s “Test from mutt” [email protected] < /tmp/message.txt
If you get the following error message: "SASL authentication failed, Could not send the message.", it means that there is a problem with the username or password.
If it works, you should momentarily receive an email at the target email account that you specified.
This is extremely useful, since it allows you to avoid installing a mail server on your VPS.
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.