Create a new keychain item, enter the Keychain Item Name as mutt, the Account Name as your gmail email address and then enter your password, then add the keychain item.
If you're using Google 2-step auth, you'll need to generate an Application-specific password from your Google Account settings and enter that as the password.
In your ~/.bashrc or ~/.zshrc export the following environment variables, the MUTT_EMAIL_ADDRESS must match what you entered in Account Name for the keychain item.
export MUTT_EMAIL_ADDRESS="[email protected]"
export MUTT_REALNAME="John Smith"
export MUTT_SMTP_URL="smtp://[email protected]:587/"
# If you're using google apps put your full email address in the smtp url
# export MUTT_SMTP_URL="smtp://[email protected]@smtp.gmail.com:587/"
Create the ~/.mutt directory and the necessary subdirectories.
$ mkdir -p ~/.mutt/cache
Then place the muttrc file below at ~/.mutt/muttrc.
Source the file you just edited, or restart your terminal, then run mutt from the command line.
