On Sun, Jan 17, 2010 at 12:57:29PM +0100, Brian Durant wrote: > Dale A. Raby wrote: > >I'm no expert, but I'm pretty sure you need the following in your .muttrc > >file in order to access a gmail account via IMAP: > > > >set folder = "imaps://imap.gmail.com:993" > >set spoolfile = "+INBOX" > >set postponed="+[Gmail]/Drafts" > > > >set header_cache= /home/dale/.mutt/cache/headers > >set message_cachedir= /home/dale/.mutt/cache/bodies > >set certificate_file= /etc/pki/tls/certs/ca-bundle.crt > And I also need to add an instance of the following for each of my > IMAP accounts? >
Managing multiple accounts with Mutt can be a little daunting... some people simply use a different Mutt instance for each account in a screen window or implement some very obscure macros to switch between accounts. Here is my configuration for reading two Gmail accounts with one Mutt instance: # Default configuration set folder=imaps://[email protected]:993 set from="[email protected]" set spoolfile="+INBOX" set postponed="+[Gmail]/Drafts" unset record set imap_check_subscribed account-hook . 'unset preconnect imap_user imap_pass imap_authenticators;set ssl_starttls=ask-yes' ## Gmail account1 [email protected] mailboxes imaps://[email protected]:993 account-hook imaps://[email protected]:993 'set [email protected]' account-hook imaps://[email protected]:993 'set imap_pass=yourpass' folder-hook 'imaps://[email protected]:993.*' 'set [email protected]' folder-hook 'imaps://[email protected]:993.*' 'set folder=imaps://[email protected]:993' folder-hook 'imaps://[email protected]:993.*' 'set spoolfile="+INBOX"' folder-hook 'imaps://[email protected]:993.*' 'set postponed="+[Gmail]/Drafts"' #folder-hook 'imaps://[email protected]:993.*' 'set trash="+[Gmail]/Trash"' folder-hook 'imaps://[email protected]:993.*' 'unset record' ## Gmail account [email protected] mailboxes imaps://[email protected]:993 account-hook imaps://[email protected]:993 'set [email protected]' account-hook imaps://[email protected]:993 'set imap_pass=yourpass' folder-hook 'imaps://[email protected]:993.*' 'set [email protected]' folder-hook 'imaps://[email protected]:993.*' 'set folder=imaps://[email protected]:993' folder-hook 'imaps://[email protected]:993.*' 'set spoolfile="+INBOX"' folder-hook 'imaps://[email protected]:993.*' 'set postponed="+[Gmail]/Drafts"' #folder-hook 'imaps://[email protected]:993.*' 'set trash="+[Gmail]/Trash"' folder-hook 'imaps://[email protected]:993.*' 'unset record' Notes: - I unset record because send email using Gmail smtp that records all sent mail in the Sent folder. If you wish to store mail you send somewhere else set the record option. - Enabling the Gmail trash folder can have secondary effects. With it enabled deleting a message completely removes the message from Gmail (e.g. takes away all it's assigned tags) and with the trash disabled deleting a message simply removes the tag it is being deleted from. To send email using GMail smtp add these lines: send-hook '~f ^[email protected]$' 'set smtp_url=smtp://[email protected]:587/' send-hook '~f ^[email protected]$' 'set smtp_pass="yourpass"' send-hook '~f ^[email protected]$' 'set realname="Your Name"' send-hook '~f ^[email protected]$' 'set signature=$HOME/.mutt/signatures/signature1' send-hook '~f ^[email protected]$' 'set pgp_autosign=yes' send-hook '~f ^[email protected]$' 'set [email protected]' send-hook '~f ^[email protected]$' 'set smtp_url=smtp://[email protected]:587/' send-hook '~f ^[email protected]$' 'set smtp_pass="yourpass"' send-hook '~f ^[email protected]$' 'set realname="Your Name"' send-hook '~f ^[email protected]$' 'set signature=$HOME/.mutt/signatures/signature2' send-hook '~f ^[email protected]$' 'set pgp_autosign=no' send-hook '~f ^[email protected]$' 'unset pgp_sign_as' Notes: - You can create signature files for each account and put them in the signature variable. - The first account has a pgp signature that I set for all email sent from that account. You can unset pgp_sign_as if you do not have pgp signatures. Some other useful configuration: set ssl_starttls=yes # activate TLS if available on the server set ssl_force_tls=yes # always use SSL when connecting to a server unset imap_passive # Don't wait to enter mailbox manually #set imap_peek=yes # Don't mark imap emails as read set imap_check_subscribed # poll mailboxes for new mail set mail_check=60 # Reduce polling frequency to a sane level set timeout=10 # Poll current mailbox more often set net_inc=5 # Display download progress every 5K set fast_reply # Skip initial prompts when replying set use_from # Needed to enable reverse_name set reverse_name # Leave my address as it appears in the message I am replying set header_cache=~/.mutt/cache/headers set message_cachedir=~/.mutt/cache/bodies set certificate_file=~/.mutt/certificates Also make sure to set your alternates correctly. Hope this is useful.... > set realname = "Your realname" > set from = "Email address" > set imap_user = "[email protected]" > set imap_pass = "yourpassword" > > How do I switch between IMAP accounts? I looked here > http://wiki.mutt.org/?action=browse&diff=1&id=UserStory/GmailMultiIMAP > and see they suggest the following: > > set folder="imaps://[email protected]" > mailboxes "=INBOX" > > set folder="imaps://[email protected]" > mailboxes "=INBOX" > > unset folder > > unset imap_passive > > > Notice that the INBOX is not the same. > > BTW, thanks for the paranoid tips :-) > -- regards, Horacio Sanson
