This blog will contain tips and recommendations for software and anything else catching my fancy

21 February 2010

Mutt and multiple imap accounts

Okay well as promised, I figured out the syntax for multiple accounts. And now, I present you with, the ultimate multiple imap account settings!

Okay, well let's dive into it.

We still need to set the configurations for the last post, as you have to have one account that you can see the tree of. Choose which one, but once you're done choosing you should have something akin to this:


set imap_user="user1@domain"
set imap_pass="pass1"
set from = "mail1"
set realname = "Your name"
set folder = "imap[s]://imapserver:port"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set record = imap[s]://imapserver/Sent
set smtp_url="smtp://user1@smtp.gmail.com:port/"
set smtp_pass="pass1"


Now that we have that settled, let's get on with the actual configuration :-)

First we need to set the mailboxes we want to connect to:


mailboxes 'imaps://user1@domain1@imapserver:port/mailbox' \
'imaps://user2@domain2@imapserver2:port/mailbox' \


At the very least you'll want those two, I personally also set Drafts and Sent to the one where I don't have the tree set up, that way I can always access my inbox/drafts/sent folders.

Now we'll work with some folder hooks, appearently you should also be able to work with account hooks but they don't really want to give me a working configuration, so I'm just using folder hooks, if you want/need account hooks you should however check out the links in the bottom of this post.
Anyway, the folderhooks:


folder-hook imaps://user1@domain1@imapserver1:port ' \
set from="user1@domain1" \
realname = "Your name" \
imap_user="user1@domain1" \
imap_pass="Pass1" \
smtp_url="smtp://user1@smtpserver1:port" \
smtp_pass = "Pass1" \
spoolfile = "+INBOX" \
record="+[Gmail]/Sent Mail" \
postponed="+[Gmail]/Drafts"'


It pretty much explains itself, and then you do the same for the second account:


folder-hook imaps://user2@domain2@imapserver2:port ' \
set from="user1@domain2" \
realname = "Your name" \
imap_user="user1@domain2" \
imap_pass="Pass1" \
smtp_url="smtp://user2@smtpserver2:port" \
smtp_pass = "Pass1" \
spoolfile = "+INBOX" \
record="+[Gmail]/Sent Mail" \
postponed="+[Gmail]/Drafts"'


And that's it. You should have a working mutt config now with two different imap accounts that you can switch between with c.

And here are the links for the account hooks:
Mutt Guide - Imap
Mutt user story
Mutt manual - Imap
My Mutt configurations

No comments:

Post a Comment