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

02 Aug 2012 Backup of Zimbra MailBox using zmmailbox

This is a short script I use to backup the Zimbra mailbox content for my users.
This has been used on a Zimbra Collaboration Server (ZCS Open Source Edition) 7.2 installation, but should work on earlier versions as well.
I use another script to backup the whole Zimbra installation, but that might be another blog post.

#!/bin/bash -x
# Backup of Zimbra mailboxes using zmmailbox
# Restore of mailbox should be performed using:
# /opt/zimbra/bin/zmmailbox -z -m user@host postRestURL -u https://HOST "//?fmt=tgz&resolve=skip" mailbox-name-date.tgz
MailBox="user1 user2 user3 userN"
DateToday=`date -I`
for name in $MailBox
sudo -u zimbra /opt/zimbra/bin/zmmailbox -z -m $ getRestURL "//?fmt=tgz" > mailbox-$name-$DateToday.tgz

The backup files are named mailbox-user1-20120802.tgz mailbox-user2-20120802.tgz …

Tags: , , , , , ,

Posted by

21 Jul 2011 Migrate Zimbra mail filter rules between servers

This is a short HOWTO migrate Zimbra mail filter rules from one server to another or even copy the rules from one user and import them to another. These commands are useful to use when you migrate user accounts between servers since mail filters are not migrated using the Zimbra to Zimbra migration script, zmztozmig . I might write a short post about migrating users between Zimbra servers later.

Export the rules to a file named filter_rules.sieve as the zimbra user

# zmprov ga zimbraMailSieveScript > filter_rules.sieve

The content of the file could look something like this

# name
zimbraMailSieveScript require ["fileinto", "reject", "tag", "flag"];

# Filtername
if anyof (header :contains ["to"] "root@localhost") {
    fileinto "foldername";

Copy the filter_rules.sieve file to the other server and import the filter rules by enclosing the filter rules with a single qoutes around the rules

# zmprov ma zimbraMailSieveScript 'require ["fileinto", "reject", "tag", "flag"];

# Filtername
if anyof (header :contains ["to"] "root@localhost") {
    fileinto "foldername";

This has been tested on a Zimbra 7.1.1 OSE server after migrating some users mailboxes from a 32-bit Zimbra server to a new 64-bit server.

Tags: , , , , , ,

Posted by

17 Nov 2009 Zimbra distribution list commands

This is just a short post describing Zimbra distribution list (mailinglist) commands.

These commands should be run as the zimbra user

# su - zimbra

List all distribution lists

# zmprov gadl

Print only members addresses of a distribution list

# zmprov gdl | grep zimbraMailForwardingAddress: | awk {'print $2'}

Show if a list is member of another distribution list(s)

# zmprov gdlm

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