UPDATED: 2002-05-19, 2004-03-15

How To Use AMaViS With Exim 4.x
*******************************
Scanning incoming/outgoing and relayed mail

by Jochen Erwied (mbs GmbH), edited by Mark Martinec
  (based on Postfix guidelines and previous work
  on Exim setup by John Burnham and Patrice Fournier)


[routers]

# instruct Exim to pass all mail using SMTP to amavisd,
# except the mail that just came-in back to Exim from amavisd
# through the local port 10025, as these messages were already
# checked and approved by amavisd

amavis:
        driver = manualroute
        condition = "${if eq {$interface_port}{10025} {0}{1}}"
        # if scanning incoming mails, uncomment the following line and
        # change local_domains accordingly
        # domains = +local_domains
        transport = amavis
        route_list = "* localhost byname"
        self = send

(from Patrice Fournier): This router must be the first router
  if you want to scan all mail. If you only want to scan mail destined
  to local domains, you either add a "Domain = local_domains" line to it
  or put it after your remote_smtp router.

(from Ralf G. R. Bergs - suggestion to elaborate the above 'condition' line):
        # Do NOT run if received via 10025/tcp or if already spam-scanned
        condition = "${if or {{eq {$interface_port}{10025}} \
                          {eq {$received_protocol}{spam-scanned}} \
                         }{0}{1}}"
(2005-10-28: removed {eq {$sender_address}{}} from the above as recommended
  by Igor D'Astolfo, as it would let through junk messages with null
  sender address)

(from Aaron Lehmann):
  The example router configuration in README.exim_v4 should include the
  no_verify option. Without this, exim will accept mail addressed to
  invalid users and then complain to postmaster@ about the frozen messages.

Better yet, don't accept mail for unknown users in the first place:
http://www.webhostgear.com/50.html



[transports]

# SMTP transport to be used for the Exim -> amavisd path;
# by default amavisd listens on the loopback interface on port 10024
# (amavisd.conf: $inet_socket_port = "10024")

amavis:
       driver = smtp
       port = 10024
       allow_localhost


The default input configuration needs to be changed to:

# Tell Exim to accept SMTP also (besides the usual port 25) on the
# loopback interface (localhost) on port 10025, which is where
# the checked messaged come from amavisd back to Exim
# (amavisd.conf: $relayhost = "127.0.0.1"; $relayhost_port = "10025")

local_interfaces = 0.0.0.0.25 : 127.0.0.1.10025




NOTE:
  There is a problem in the Net::SMTP Perl module (version 2.17
  and earlier), which as far as I know only affects the Exim setup
  with amavisd-new: MTA-generated notifications from <> appear to be
  comming from <<>> and are rejected by MTA. Please upgrade the Perl
  module libnet (which contains Net::SMTP) to version libnet-1.12.
  Upgrading this module is probably a good idea even if you use other MTA.
