Exim4

Forward a message but still leave a copy on the server?

I am using Debian etch for production, plus Exim4 with per user ~/Maildir support. Since I hope to forward each user message to their own public email for backup, Procmail FAQ give me a useful example.

First of all, check if your Exim4 have ~/.procmailrc supported, which usually already there. Find the follow code snippet from /etc/exim4/exim4.conf.template:

#####################################################
### router/700_exim4-config_procmail
#####################################################

procmail:
  debug_print = "R: procmail for $local_part@$domain"
  driver = accept
  domains = +local_domains
  check_local_user
  transport = procmail_pipe
  # emulate OR with "if exists"-expansion
  require_files = ${local_part}:\
                  ${if exists{/etc/procmailrc}\
                    {/etc/procmailrc}{${home}/.procmailrc}}:\
                  +/usr/bin/procmail
  no_verify
  no_expn

#####################################################
### end router/700_exim4-config_procmail
#####################################################

Work around together with Debian's procmail example (/usr/share/doc/procmail/examples/), just create a ~/.procmailrc as below:

# Please check if all the paths in PATH are reachable, remove the ones that
# are not.

PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
LOGFILE=$MAILDIR/from
LOCKFILE=$HOME/.lockmail

:0c
! someone@example.com

Send an email to this user, check the mail log with tail -f -n 50 /var/log/exim4/mainlog and you will find that message already forward to your target public email address, with a saved local copy :-)

Exim4 + Maildir + Procmail on Debian etch mini-HOWTO

What is Procmail? From Wikipedia (http://en.wikipedia.org/wiki/Procmail):

Procmail is a mail delivery agent (MDA) or mail filter, a program to process incoming emails on a computer, widely used on Unix systems. It is typically invoked from an MTA like Sendmail; this makes the mail processing event-driven. The companion-tool formail allows procmail to be used in batch-processing on mail that already is in your mailbox.

Common operations carried out with procmail include filtering and sorting of emails into different folders according to keywords in from, to, subject, text of the mail, or sending autoreplies, but more sophisticated operations are also possible.

A common practice is to let procmail call an external spam filter program, such as SpamAssassin. This method can allow for spam to be filtered or even deleted.

We can combine Procmail with Exim4, filter mail with some extra rules, and deliver incoming mail into other location. Working this on Debian etch is not too difficult.

First of all, we will need the Procmail package (you usually have this already):

apt-get install procmail

Then we will need the /etc/procmailrc, which defined the rules that will be apply. We can use the example as references:

cat /usr/share/doc/procmail/examples/3procmailrc  > /etc/procmailrc

NOTICE!! This sample is target for mailbox format, and so we will need to take the following changes for Maildir support:

MAILDIR =       $HOME/Maildir/  # You'd better make sure it exists
DEFAULT =       $MAILDIR
#LOGFILE =      $MAILDIR/from
LOCKFILE=       $HOME/.lockmail

By default, Exim4 will route incoming mail to procmail if /etc/procmailrc exists, and transport it though procmail_pipe. you don't need to take extra handling for this ;-)

Exim4 + Maildir + Mutt on Debian etch mini-HOWTO

It is not too difficult to have Maildir support under Exim4 of Debian etch, simply run:

dpkg-reconfigure exim4-config

And answer "Maildir format in home directory" when asking for "Delivery method for local mail"

BTW, the main point is this line under /etc/exim4/update-exim4.conf.conf:

dc_localdelivery='maildir_home'

On the other hand, during testing your Exim4 configuration, e.g.:

echo "my test" | mail -s "test message" root

You may also hope to check if the mail is actually delivered to your new Maildir.

Next is about Mutt. Default Mutt setting just support for mailbox format, with lossy layout. User can customize their Mutt behavior by editing ~/.muttrc. Thanks to Debian, we have a good example from /usr/share/doc/mutt/. Just run:

zcat /usr/share/doc/mutt/examples/sample.muttrc.gz > ~/.muttrc

And you will get a good template.

Also create your ~/.muttrc-local with following lines, so override default setting with Maildir support:

set mbox_type=Maildir
set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir"
set record="+.Sent"
set postponed="+.Drafts"
set spoolfile="~/Maildir"

That's all! Its time to enjoy Mutt with your Maildir :)

Exim4 + Courier + SSL on Debian etch mini-HOWTO

Not every one need a complete solution of virtual hosting email system: you may only hope to have a simple email system within your personal server, and let you check your system log remotely. For this, you may hope you email system come with:

  1. Support both SMTP, SSMTP with authentication
  2. Support both POP3, POP3S, IMAP2, IMAPS

And that's all! This simple HOWTO will guide you though the detail steps.

Exim4 + ClamAV + SpamAssassin + Greylistd on Debian etch mini-HOWTO

What if you hope to have ClamAV and SpamAssassin with your Debian Exim4, but don't really hope for a complete virtual hosting email system with vexim? You may follow this simple guideline and set them up within 15min :)

Exim4 + Mailman + Apache2 on Debian etch mini-HOWTO

This is just a very fast and rough simple guideline for setting up Mailman + Exim4 based on Debian etch. For sure that we will also configure Apache2 for Mailman web interface. Not much detail will be mentioned, please refer to corresponding document if you hope to understand more. Debian also come with a handy guideline from /usr/share/doc/mailman/README.Exim4.Debian, so you should have a look with it before follow this guideline :)

Syndicate content