I encountered some issues setting up multiple email accounts with mutt, so I decided to provide as much info as possible for other people who may encounter issues doing the same.
One Google Apps hosted and another (hosted with my company) email accounts were set up in this tutorial, make sure you change personal details like username, password, email account.
1) Install MUTT email client and the needed dependencies:
For RPM based distributions use:
yum install cyrus-sasl-plain mutt
For DEB based distributions use:
apt-get install libsasl2 mutt
2) Create a new file called .muttrcÂ in your home directory (do not ignore the leading dot “.”)
macro index <F5> 'source ~/.mutt/appsdomain.tld!' macro index <F6> 'source ~/.mutt/companydomain.tld!' account-hook appsdomain.tld 'set [email protected] imap_pass=appsaccountpassword' account-hook companydomain.tld 'set [email protected] imap_pass=companyaccountpassword' set move = noÂ #Prevents mutt from asking to move read messages to INBOX set imap_keepalive = 900 ignore "Authentication-Results:" ignore "DomainKey-Signature:" ignore "DKIM-Signature:" hdr_order Date From To Cc #Sorting emails by the given criteria (from left to right) ignore * unignore from: date subject to cc unignore x-mailing-list: posted-to: unignore x-mailer: #Nice looks set markers=no # removes the "+" sign from the beginning of wrapped lines set pager_index_lines= 5 set sort = 'threads' set sort_aux = 'last-date-received' #Set your editor set editor='vim + -c "set textwidth=80" -c "set wrap" -c "set nocp" -c "?^$"' # .mutt/muttrc folder-hook 'appsdomain.tld' 'source ~/.mutt/appsdomain.tld' folder-hook 'companydomain.tld' 'source ~/.mutt/companydomain.tld' # Choose which account should be loaded on startup, uncomment only one of these: #source ~/.mutt/appsdomain.tld #source ~/.mutt/companydomain.tld
3) Create the .mutt directory for storing special/per account configuration files
mkdir -p /home/yourusername/.mutt/
4) Create the configuration file for your first account (appsdomain.tld for me):
color status cyan default set from = "[email protected]" set realname = "Firstname Lastname" set imap_user = "[email protected]" set imap_pass = "appsaccountpassword" set folder = "imaps://imap.gmail.com:993" set spoolfile = "+INBOX" set postponed ="+[Gmail]/Drafts" set certificate_file =~/.mutt/certificates
5) Create the configuration file for your second account (companydomain.tld for me):
color status green default set from = "[email protected]" set hostname = "companydomain.tld" set folder = "imaps://companydomain.tld/" set postponed = "=Drafts" set spoolfile = "imaps://companydomain.tld/INBOX" set signature = "~/.mutt/companydomain.tld.signature"
6) Set a signature for your accounts (optional)
cat << 'EOF' > ~/.mutt/companydomain.tld.signature Kind regards, FirstName LastName Your Company EOF
7) Open mutt by simply typing mutt in your console: