I started using mutt for console mail awhile ago and always really appreciated its rather functional and utilitarian approach. Mail clients on Linux come and go and I ended up doing Mozilla Thunderbird because it would work with how I wanted to handle my email. Basically, I use gmail for it all and then I have all my email pool up there and set up identities in Thunderbird to read and reply. Hell, I even use Thunderbird for work email.
But there always comes a time when I want to try to get the mongrel of mailers back. So, last night after reading a few blogposts here and there, I found the way. Here’s a snippet of my .muttrc which gets it going:
set from=mperry@lnxpowered.org
set realname=”Michael Perry”
set spoolfile = imaps://imap.gmail.com:993/INBOX
set folder = “imaps://imap.gmail.com:993″
set imap_user=<mygmailacct>@gmail.com
set imap_pass=xxxxx
set smtp_pass=yyyyyy
mailboxes =Mikesmail
mailboxes =LinkedIn
set header_cache=”$HOME/.mutt/.mutt_header_cache”
set smtp_url=”smtp://<mygmailacct>@smtp.gmail.com:587/”
set record=”+[Gmail]/Sent Mail”
set postponed=”+[Gmail]/Drafts”
So what does this all do? What’s the magic? To start with it, it places the spoolfile for the mail server at Gmail. Then it declares where the files/folders can be found. Finally it sets the imap password. If you read down the config, you will see where it sets the smtp_url. This was a new setup for me; but I managed to grok I could get the password saved by simply doing smtp_pass=yyyy.
Next thing is the multiple identities for my other accounts. Here’s the muttrc snippet to do multiple identities with Gmail IMAP:
unset metoo
alternates “(mperry@mikesmail.org)|(mperry@lnxpowered.org)”
folder-hook . my_hdr From: “Michael Perry” <mperry@lnxpowered.org>
folder-hook . ’set signature=’set signature=~/.signature’
folder-hook =Mikesmail my_hdr From: “Michael Perry” <mperry@mikesmail.org>
folder-hook =LinkedIn my_hdr From: “LinkedIn <linkedin@mikesmail.org>
Mikesmail and LinkedIn are the two accounts I want to get new mail announcements in Mutt and I want to send and respond with those email accounts. The way it works is to “enter” the folder and then write the mail. If I get an email from someone to that account, mutt just manages the account with the folder_hook commands. I could also set a special signature for each one if I wanted by doing a folder-hook for each folder in the same format as the default one above.
So, why would you want to do this? Well, mutt handles mailing lists just the best. It is all knowing and omnipotent with mailing lists. But the other thing is bending mutt to my will and making the mongrel behave with gmail.
And it works.
Update of Sorts
If you use the line for Sent Mail above, it will cause gmail to create duplicates in your Sent_Mail folder for every email you send with mutt. You can safely omit this line from the .muttrc with no adverse affects. Mail will still be stored in your Sent_Mail folder. Another thing to note. This will also work with google domains with no big issues. What I’m thinking of doing is subscribing to a variety of email lists on my google domain and using mutt to read that mail. The mongrel does its best with email lists methinks.








