[Exim] converting qmail to exim3 system

Top Page
Delete this message
Reply to this message
Author: Nico Erfurth
Date:  
To: exim-users
Subject: [Exim] converting qmail to exim3 system
Hi,

a friend asked me to convert a qmail system to an exim3 system, i was a
little bit limited and couldn't use ALL posibilities to make the config
clean and simple (no embedded perl, and no exim4). He wanted to use the
default exim-package of debian, and so i only could use the features they
provide. I hope someone is interested in this config, and maybe someone
has some ideas to make the config a little bit nicer. I'm not a qmail
expert, nor a qmail user at all, so i created everything by the
information he provided me.

This config is no in production use yet, i stripped out some things, that
are not needed to be explained.

If some qmail-expert finds an error in this config please contact me.

If you are interested, i could rework this for exim4, where some things
could be done in other ways, and the rewrites for ./Maildir and &email are
not needed anymore.

P.S. Thanks to Phil (again) for this wonderful MTA, that makes all this
possible ;)))

----------------------------------------------

# Needed for the ./Maildirfix
locally_caseless = false


remote_smtp:
driver = smtp

# The default transport, if nothing else is specified in one of the
# .qmail files
mailbox_delivery:
driver = appendfile
file = $home/Mailbox
delivery_date_add
envelope_to_add
return_path_add

# pipe transport
address_pipe:
driver = pipe
return_output


# This transport is used for handling deliveries directly to files that are
# generated by aliasing or forwarding.

address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add

# this handles generated maildir deliveries
address_maildir:
driver = appendfile
maildir_format
delivery_date_add
envelope_to_add
return_path_add
prefix =
suffix =
check_string =

# This transport is used for handling autoreplies generated by the filtering
# option of the forwardfile director.

address_reply:
driver = autoreply


# This one catches addresses in the form of qmailfix-USER-mailbox/maildir
qmail_catch_maildir:
driver = forwardfile
prefix = qmailfix-
suffix = -*
directory_transport = address_maildir
file_transport = address_file
data = $home/${substr_1:$local_part_suffix}
user = ${lc:$local_part}

# This one lowercases the address (we need to force this here, because we
# need cases in qmail_catch_dir)
qmail_fix_localpart:
driver=smartuser
new_address = ${lc:$local_part}@$domain


# Catches users in /etc/qmail/users
qmail_system_aliases:
driver = forwardfile
require_files = "/etc/qmail/users/qmail-$local_part"
file = "/etc/qmail/users/qmail-$local_part"
file_transport = address_file
pipe_transport = address_pipe
user=$local_part
directory_transport = address_maildir

# This one handles .qmail-SUFFIX and .qmail files
qmail_user_aliases:
driver = forwardfile
suffix = -*
suffix_optional = true
require_files = "$home/.qmail$local_part_suffix"
file = "$home/.qmail$local_part_suffix"
file_transport = address_file
pipe_transport = address_pipe
user=$local_part
directory_transport = address_maildir

# catch everything without a suffix and is a local_user
# needs to be done here, so we don't catch it accidently
# after the qmail_user_default_aliases-qmail_strip_suffix-loop ends

localuser:
driver = localuser
transport = mailbox_delivery
user=$local_part

# This one is for catch-alls in .qmail-(suffix minus last_part)-default
# it replaces the last part of the suffix, and replaces it with -default
qmail_user_default_aliases:
driver = forwardfile
suffix = -*
require_files = "$home/.qmail${sg {$local_part_suffix}{-[^-]*\\$}{-default}}"
file = "$home/.qmail${sg {$local_part_suffix}{-[^-]*\\$}{-default}}"
file_transport = address_file
pipe_transport = address_pipe
directory_transport = address_maildir
user=$local_part

# Strip last part from $local_part_suffix and reroute address
# The new address will only run in a loop between
# qmail_user_default_alias and qmail_strip_suffix until no
# suffix is left
qmail_strip_suffix:
driver=smartuser
suffix = -*
new_address = $local_part${sg {$local_part_suffix}{-([^-]*)\$}{}}@$domain
new_director = qmail_user_default_aliases


# the remote router
lookuphost:
driver = lookuphost
transport = remote_smtp
ignore_target_hosts = 127.0.0.0/8:0.0.0.0


# Retry config
*                      *           F,2h,15m; G,16h,1h,1.5; F,4d,8h


# We need some special rewrite rules, to emulate some braindamaged
# qmail-"features"

# Rewrites the &user@domain syntax that qmail allows in its .qmail* files
^&(.+)@(.+)$ $1@$2 tT

# Rewrites ./Maildir/@domain and ./Mailbox@domain to
# qmailfix-USER-./Maildir/@domain that will be filtered in
# qmail_catch_maildir
# This must be done, because qmail allows ./Maildir/ and ./Mailbox in it's
# .qmail-files and exim threats this as addresses
^\./(.+)@(.+)$ "qmailfix-${extract {1}{-}{${lc:${if !eq \
{}{$parent_local_part}{$parent_local_part}\
{$original_local_part}}}}}-${rxquote:$1}@$2" T

# Emulates the domain+ stuff of qmail
# qmails allows to define a plusdomain, if you write to user@host+ it will
# rewrite this address to user@???
^(.+)@(.*)\+$ $1@$2.plusdomain