Configure console email client mutt with Zimbra as IMAP/SMTP server

This is actually a an extended version of a post I did in 2009 titled Configure mutt for Zimbra and IMAP but this time I have added more options to the mutt config file.This example was tested on a Ubuntu 10.04 LTS server with Zimbra version 8.0.5 but will most likely be working on other versions as well.First you need to install the mutt email client.Next you need to configure mutt so that it knows where to look for emails.My config file ~/.mutt/muttrc file looks something like this

set copy="yes"                           # Save sent mail on Zimbra
set from=""     # Your email 
set folder="imaps://"    # The remote Zimbra IMAP URI
set imap_idle="yes"                      # Use IMAP IDLE for pushing mail
set imap_user="username"                 # Your IMAP username
set mail_check="60"                      # Poll every 60 seconds rather than waiting 24 minutes for new mail
set postponed="+Drafts"                  # Saving postponed messages on Zimbra for later
set realname="First Last"                # Your first name and last name
set record="+Sent"                       # Save sent mail to "/Sent" on Zimbra
set reverse_alias="yes"                  # If email is saved in your alias file, show the name of the mail 
set signature="~/.mutt/sig.txt"          # Your email signature, if any
set smtp_url="smtps://" # The SMTPS URI for sending mail
set sort_alias="alias"                   # Sort the alias file by alias
set spoolfile="imaps://" # Where your inbox is located on Zimbra
set ssl_force_tls="yes"                  # Force TLS rather than SSL. Supercedes "
set ssl_starttls"
source ~/.mutt/aliases                   # Alias file to store your "address book"
source ~/.mutt/lists                     # Store any mailing lists here, and respond to the list, rather than "reply to all"Create the file if it does not already exist
$ touch ~/.mutt/muttrc

mutt will complain about missing files mentioned in the configuration above if you do not create them first

$ touch ~/.mutt/sig.txt$ touch ~/.mutt/aliases
$ touch ~/.mutt/lists

You are now ready to start mutt as a console email client.

This setup will request for your password every time you start mutt and every time you send email.
This post does not describe how you can have mutt to remember your encrypted password using GPG key.
I have added some extra configuration (~/.mutt/muttrc) in addition to the code above but that is not required but I have found it useful

set askbcc="yes"                         # Ask for Bcc: recipients when composing a message
set askcc="yes"                          # Ask for Cc: recipients when composing a message
set charset="utf-8"                      # Set the character encoding to UTF8
set certificate_file="~/.mutt/certs"     # SASL2 certificate location
set edit_headers="yes"                   # Edit the headers when composing a message
set envelope_from="yes"                  # Use quoted-printable encoded message when "From " is at the beginning of a line
set header_cache="~/.mutt/cache/headers" # Location to save cached mail headers
set hostname=""          # Set your hostname in the headers
set imap_check_subscribed="yes"          # Check 'subscribed' folders only
set message_cachedir="~/.mutt/cache/bodies" # Location to save cached mail bodies
set message_cache_clean="yes"            # Delete cache files if deleted off the server
set move="no"                            # Don't move read mail
set pager_index_lines="11"               # Show 11 lines of the index when reading messages
set quote_regexp="^([ \t]*[|>:}])+"      # Quoted messages (get rid of '#' which is in the default
set use_from                             # Allow me to switch email addresses in my editor
set sort=threadsset 
set sort_browser=dateset 
set sort_aux=reverse-last-date-received  # Set editor with automatic line wrapping at 75 characters
set editor="vim"
set textwidth=75 wrap'"

The header_cache is useful to speed the startup because you do not need to read all the mails in the Inbox every time you start mutt.