This documents exim4.

In general, dpkg-reconfigure exim4-config will do most of what you need, in fact, probably all. Use it well.

/etc/aliases will do forwarding, but you can't do wildcards here (I think)

Read /usr/share/doc/exim4/README.Debian.gz. It answers lots of questions.

catchall address

To make a catchall address which only catches a certain prefix, use

catchall_prefix:
  debug_print = "R: catchall_prefix for $local_part@$domain"
  driver = redirect
  local_part_prefix = rd1-
  data = richard

'data = xxx' is the user to forward it to, and the rest should be obvious. It is also possible to use local_part_suffix = whatever to match suffixes instead of prefixes.

If you're using debian's multifile config stuff for exim, then you wuld put that stuff ^ into a file named something like /etc/exim4/conf.d/router/999_prefixed-yourinitials-YYYY-MM-DD, run update-exim4.conf and then run /etc/init.d/exim4 reload.

smtp auth as a server

just edit /etc/exim4/passwd.client.

Schizophrenic Addresses

Spread across three files because it must be so. For a description, read the comments in the first file below.

main

/etc/exim4/conf.d/main/999_schizophrenic_address_config_dmc-2009-03-12:

# DMC 2009-03-12

# Config options for schizophrenic email addresses.
#

SCHIZOPHRENIC_PRIVATE_ADDRESS = david
SCHIZOPHRENIC_PUBLIC_ADDRESSES = mchjra : ldyru
SCHIZOPHRENIC_RETIRED_ADDRESSES = dhtdf : cuysda : ivcd

SCHIZOPHRENIC_DELIVER_TO_RETIRED_ADDRESSES_ANYWAY = true


# motivation: I wanted a set of conveniently disposable email addresses
# that I could discard when they started getting too much spam. But I
# still wanted humans to retain the ability to contact me even when the
# only address they have for me is one that I have discarded.
#
# Here's how it works:
#
# The username in the To: header of incoming emails is compared to
# the PUBLIC and RETIRED address lists above. Then one of three
# things will happen:
# 1. If the username matches a PUBLIC address, then the email is delivered
#    to the local user designated by PRIVATE_ADDRESS as if it had been
#    addressed to that user in the first place. Also the header
#    X-Schizophrenic-Address is set to "valid".
# 2. If the username matches a RETIRED address, then a reply message is sent
#    to the originator of the email which includes some text informing them
#    of your new email address at X@$domain where X is the first address in
#    the PUBLIC_ADDRESSES list. If the DELIVER_TO_RETIRED_ADDRESSES_ANYWAY
#    macro is "true", "yes", or "1", then the message is passed through to
#    the PRIVATE_ADDRESS just like in case 1, but with X-Schizophrenic-Address
#    header set to "invalid". (That was done deliberately to make it really
#    easy to filter them all out.) If the option is "false", "no", or "0",
#    then the message will be dropped and you will never even know that any
#    emails are being sent to retired addresses unless you check your exim
#    logs.
# 3. Otherwise, it will pass the email on to the rest of exim's processing
#    system.
#
# Remember to update your /etc/email-addresses file.




# list of address patterns that will NEVER be sent an autoreply message
# This is defined here because it can't be defined in the routers section,
# even though that *would* be more natural.
# copied from http://wiki.exim.org/EximAutoReply
addresslist schizophrenic_noautoreply_senders = \
  ^.*-request@.* : \
\#  #^request.*@.* : \
  ^owner-.*@.* : \
  ^.*-owner@.* : \
  ^.*-admin@.* : \
  ^bounce-.*@.* : \
  ^.*@bounce\..* : \
  ^.*-outgoing@.* : \
  ^.*-relay@.* : \
  ^.*-bounces@.* : \
  ^.*-bounce@.* : \
  ^.*-confirm@.* : \
  ^.*-errors@.* : \
  ^mailer@.* : \
  ^postmaster@.* : \
  ^mailer-daemon@.* : \
  ^mailer_daemon@.* : \
  ^majordomo@.* : \
  ^majordom@.* : \
  ^mailman@.* : \
  ^nobody@.* : \
  ^reminder@.* : \
  ^autoreply.*@.* : \
  ^.*-autoresponder@.* : \
  ^autoresponder@.* : \
  ^listserv@.* : \
  ^daemon@.* : \
  ^server@.* : \
  ^root@.* : \
  ^noreply.*@.* : \
  ^no-reply@.* : \
  ^bounce@.* : \
\#  ^news@.* : \
\#  #^news.*@.* : \
\#  #^newsletter-?.*@.* : \
\#  #^.*-?newsletter@.* : \
\#  #^.*@newsletter.* : \
  ^request.*@.* : \
  ^httpd@.* : \
  ^lighttpd@.* : \
  ^www@.* : \
  ^www-data@.* : \
  ^nagios@.* : \
\#  ^sales@.* : \
\#  ^info@.* : \
\#  #^.*@info.* : \
\#  ^fetchmail.*@.* : \
  ^listmaster@.* : \
  ^mailmaster@.* : \
\#  ^webmaster@.* : \
  ^squid@.* : \
  ^support@.* : \
  ^exim@.* : \
\#  #^fetchmail.*@.* : \
  scomp@aol.net

router

/etc/exim4/conf.d/router/999_schizophrenic_address_router_dmc-2009-03-12:

# DMC 2009-03-12

schizophrenic_redirect_public_addresses:
  driver = redirect
  local_parts = SCHIZOPHRENIC_PUBLIC_ADDRESSES
  headers_add = X-Schizophrenic-Address: valid
  data = SCHIZOPHRENIC_PRIVATE_ADDRESS


schizophrenic_bounce_retired_addresses:
  driver = accept
  # big list of conditions copied from http://wiki.exim.org/EximAutoReply
  senders = ! +schizophrenic_noautoreply_senders
  condition = ${if or { \
    { match {$h_precedence:} {(?i)junk|bulk|list} } \
    { eq {$sender_address} {} } \
    { def:header_X-Cron-Env: } \
    { def:header_Auto-Submitted: } \
    { def:header_List-Id: } \
    { def:header_List-Help: } \
    { def:header_List-Unsubscribe:} \
    { def:header_List-Subscribe: } \
    { def:header_List-Owner: } \
    { def:header_List-Post: } \
    { def:header_List-Archive: } \
    { def:header_Autorespond: } \
    { def:header_X-Autoresponse: } \
    { def:header_X-Autoreply-From: } \
    { def:header_X-eBay-MailTracker: } \
    { def:header_X-MaxCode-Template: } \
    { match {$h_X-Auto-Response-Suppress: } {OOF} } \
    { match {$h_X-OS:} {HP Onboard Administrator} } \
    { match {$h_X-MimeOLE:} {\N^Produced By phpBB2$\N} } \
    { match {$h_Subject:} {\N^Yahoo! Auto Response$\N} } \
    { match {$h_Subject:} {\N^ezmlm warning$\N} } \
    { match {$h_X-FC-MachineGenerated:} {true} } \
    { match {$message_body} {\N^Your \"cron\" job on\N} } \
    { match {$h_Subject:} {\N^Out of Office\N} } \
    { match {$h_Subject:} {\N^Auto-Reply:\N} } \
    { match {$h_Subject:} {\N^Autoresponse:\N} } \
    { match {$h_Subject:} {\N(Auto Reply)$\N} } \
    { match {$h_Subject:} {\N(Out of Office)$\N} } \
    { match {$h_Subject:} {\Nis out of the office.$\N} } \
    { match {$h_From:} {\N(via the vacation program)\N } } \
    } } {no} {yes} }
  local_parts = SCHIZOPHRENIC_RETIRED_ADDRESSES
  transport = schizophrenic_automatic_reply
  unseen


schizophrenic_redirect_retired_addresses:
  driver = redirect
  local_parts = SCHIZOPHRENIC_RETIRED_ADDRESSES
  condition = SCHIZOPHRENIC_DELIVER_TO_RETIRED_ADDRESSES_ANYWAY
  headers_add = X-Schizophrenic-Address: invalid
  data = SCHIZOPHRENIC_PRIVATE_ADDRESS


schizophrenic_ignore_retired_addresses:
  driver = accept
  local_parts = SCHIZOPHRENIC_RETIRED_ADDRESSES
  condition = !SCHIZOPHRENIC_DELIVER_TO_RETIRED_ADDRESSES_ANYWAY
  transport = schizophrenic_dump_to_devnull

transport

If you want to change the text of the autoreply message, edit this file.

/etc/exim4/conf.d/transport/999_schizophrenic_address_transport_dmc-2009-03-12:

# DMC 2009-03-12


schizophrenic_automatic_reply:
  driver = autoreply
  to = $reply_address
  from = <>
  #       ^-- null sender makes it look more like a bounce
  subject = Mail delivery failure: email address has changed
  return_message
  text = THIS MESSAGE WAS GENERATED AUTOMATICALLY.\n\
         The address <$local_part@$domain> has expired, so no new mail can be delivered there. \n\
         \n\
         You MUST RESEND your email to the new address:\
         <${local_part:${extract{1}{:}{SCHIZOPHRENIC_PUBLIC_ADDRESSES}} }@$original_domain>. \n\
         Update your addressbook and send any future correspondence to the new address.\n\
         \n\
         \n


schizophrenic_dump_to_devnull:
  driver = appendfile
  file = /dev/null

DebianNotes/EximConfig (last edited 2009-07-22 01:34:38 by MrGreen)