A chronological documentation test project, nothing serious, really!

18 Oct 2013 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.

Tags: , , , , ,

Posted by

24 May 2009 Configure mutt for Zimbra and IMAP

This post describes how to configure the command line e-mail client mutt to use your Zimbra IMAP mailbox.

Open the text file .muttrc, located in your home directory. If it does not exist, create it. Add or replace the following lines with your own user ID:

set spoolfile=imaps://
set folder=imaps://

If you would like to use your Zimbra Sent and Drafts folders for sent and postponed messages in Mutt, also add the following lines, as above:

set record=imaps://
set postponed=imaps://

Mutt can now be used as a e-mail Zimbra client with access to all your mail. You can change folder in mutt by pressing the etter c. If you do not know the name of the folder, just press ?.

Tags: , , ,

Posted by

04 Apr 2007 Create a Courier-imap shared Spam folder

My aim is to ask procmail to deliver everyone’s spam emails into “shared.System.Spam” IMAP folder. All my mail-receiving users belong to a unix group called “users“.

  1. I need to create the shared maildir first. I put all my shared folders under “/var/spool/Maildir“, so first I will create a “System” sharable maildir, and then create a “Spam” folder inside it. Run these commands as root.
    # maildirmake -S /var/spool/Maildir/System
    # maildirmake -s write -f Spam /var/spool/Maildir/System
  2. The problem with the default “maildirmake -s write” is that it creates directories with mode 1777. Because of this sticky bit (mode ‘t‘ displayed in directory listing), you cannot remove files that does not belong to you. However, it is necessary for Courier IMAP to move all email files from ‘new/‘ to ‘cur/‘ when a user tries to select that folder. Thus the files that cannot be moved, i.e. files belong to other users, will not be picked up by Courier IMAP. That is the reason you cannot see other users’ newly delivered emails, even though these files do exist in the shared folder.The quick ‘n’ dirty solution would be turning off the sticky bit. But we also want to restrict the access to our user group only. So..
    # chgrp -R users /var/spool/Maildir/System/.Spam
    # chmod 1770 /var/spool/Maildir/System/.Spam/[cnt]??
  3. Finally, you want to link the shared folder to your own maildir. Run this as a regular user.
    $ maildirmake --add System=/var/spool/Maildir/System $HOME/Maildir

    You might need to run the above command for every user which needs to access the sharable maildir. Alternatively, you can set up a file called “/etc/maildirshared” (check the maildirmake man page for the exact location) to have the following configuration:

    System	/var/spool/Maildir/System

    Note that it is a character between “System” and the directory.

  4. Now you should be able to subscribe to the shared IMAP folder through your favourite mail user agent (Mozilla Mail in my case)! You should also be able to see all the new emails delivered to this folder, even if they are addressed to another user.

Tags: , , ,

Posted by