I messed around for a while today trying to get mutt set up to use my Gmail account. Of course, I use the web interface 95% of the time, but sometimes I am on systems that do not have X and/or sendmail/procmail/fetchmail/whatever available. So I wanted a simple, self-contained way to check, and occasionally send, mail from the command line via Gmail. Here’s how mine is set up, in case it’s useful to anyone.
- mutt with POP3 and SSL support compiled in (for receiving mail)
- ssmtp (for sending mail)
mutt configuration (in ~/.muttrc)
mail check options
mail send options
check for new mail on startup
SMTP command (~/bin/gmailout)
This is just a shell script with the connection information for Gmail’s SMTP server. It invokes ssmtp with certain options.
/usr/sbin/ssmtp -au “gmail-address” -ap “password” $@
ssmtp configuration (/etc/ssmtp/ssmtp.conf)
Just be sure to replace “gmail-address,” “password,” and “username” to fit your information. And the “gmailout” script must be executable. That’s everything. I didn’t find it all in one place, so this is hopefully a working configuration for anyone who wants to do the same thing.