* exist only to provide compatibility with Sendmail. -- Terminate options -B * Ignored -bd + Start daemon -bdf + Start daemon and run it in the foreground -be Test string expansion -bF Test system filter file -bf Test user filter file -bfd Set domain for filter testing -bfl Set local part for filter testing -bfp Set local part prefix for filter testing -bfs Set local part suffix for filter testing -bh Test incoming SMTP call -bi * Run bi_command -bm Accept message on standard input -bP Show configuration option settings -bp + List the queue -bpa + ... with generated addresses as well -bpc + ... but just show a count of messages -bpr + ... do not sort -bpra + ... with generated addresses, unsorted -bpru + ... only undelivered addresses, unsorted -bpu + ... only undelivered addresses -brt Test retry rules -brw Test rewriting rules -bS Read batch SMTP on standard input -bs Run SMTP on standard input and output -bt Test address directing and routing -bV Verify version number -bv Test recipient address verification -bvs Test sender address verification -C + Use alternate configuration file -D + Define macro for configuration file -d Turn on debugging output -dropcr Remove CR character in input: became a no-op in 4.21 -E Internal use only -ex * Synonym for -oex (for several different x) -F Set calling user name -f # Set calling user address -G * Ignored -h * Ignored -i Dot does not terminate message -M + Force deliver specific message -Mar + Add recipient to message -MC Internal use only -MCA Internal use only -MCP Internal use only -MCQ Internal use only -MCS Internal use only -MCT Internal use only -Mc + Deliver specific message -Mes + Edit message sender -Mf + Freeze message(s) -Mg + Give up (bounce) message(s) -Mmad + Mark all recipients delivered -Mmd + Mark one recipient delivered -Mrm + Remove message(s) (no bounce) -Mt + Thaw message(s) -Mvb + View message body -Mvh + View message header -Mvl + View message log -m * Ignored -N + Deliver without transporting -n * Ignored -oA * Supply argument for -oB Set max messages down one connection -odb Background delivery -odf Foreground delivery -odi Foreground delivery -odq Queue message; do not deliver -odqs ... do not do SMTP deliveries -oee Error sent by mail; zero return code -oem Error sent by mail; non-zero return code -oep Error written to standard error stream -oeq * Error written to standard error stream -oew * Error sent by mail; non-zero return code -oi Dot does not terminate message -oitrue * Dot does not terminate message -oMa # Supply host address -oMaa # Supply authenticator name -oMai # Supply authenticated id -oMas # Supply authenticated sender -oMi # Supply interface address -oMr # Supply protocol name -oMs # Supply host name -oMt # Supply ident string -om * Ignored -oo * Ignored -or Timeout non-SMTP messages -ov * Verbose; same as -v -oX Alternative port for daemon -pd Delay Perl interpreter start -ps Do not delay Perl interpreter start -q + Run the queue ) -qf + ... force delivery ) Other combinations are -qff + ... and include frozen messages ) possible. The syntax is -qi + ... initial deliveries only ) -ql + ... local deliveries only ) -q[q][f][f][i|l][time] -qq + Two-stage queue run ) -qR * Same as -R -qS * Same as -S -R Select by recipient in queue run -Rf ... with forcing -Rff ... and frozen messages -Rr ... using regular expression -Rrf ... with forcing -Rrff ... and frozen messages -r * Synonym for -f -S Select by sender in queue run -Sf ... with forcing -Sff ... and frozen messages -Sr ... using regular expression -Srf ... with forcing -Srff ... and frozen messages -t Take recipients from header lines -U * Ignored -v Verbose - shows SMTP dialogue and other delivery info -x Ignored (AIX compatibility) ================================================= testing exim -C exim.conf -bt rafael ------------------------ exim -v admin@dom.ain From: admin@ To: raffi@linwin.com Subject: Testing exim Testing exim . ------------------------ exim -C /etc/exim/exim_example.conf -d -bt user@example.com ------------------------ exim -bh 198.144.208.138 HELO linwin.com MAIL FROM: RCPT TO: DATA Subject: testing your message here . QUIT ------------------------ ------------------------ ============================= update-exim4.conf update-exim4.conf --keepcomments ============================= route/relay all incoming to backend manualroute_domains: driver = manualroute domains = lsearch;/etc/exim/manualroute route_data = ${lookup{$domain}lsearch{/etc/exim/manualroute}} transport = remote_smtp no_more This example expects a file /etc/exim/manualroute with a list of domains that you want routed, along with the servers to route them to (colon-separated), e.g.: some.domain: my.internal.server some.other.domain: foo.bar.server : fallback.server : 192.168.0.1 That would route messages for "some.domain" to "my.internal.server" etc. ================================================= exinext That will inspect the retry database both for the domain (for routing failures) + for the hosts it routes to (for delivery failures). ------------------------ exim_tidydb run every now and again. ------------------------ ================================================= If a line in the main part of the configuration (that is, before the first 'end' line) begins with an upper-case letter, it is taken as a macro definition, of the form = ================================================= Directors `aliasfile': This director handles local part expansion via a traditional alias file foo: uid=1234 gid=5678 mailbox=/home_1/foo/inbox `forwardfile': This director handles local part expansion via a traditional forward file or, if so configured, by a user's filter file Mailing lists can be handled by file names of the form /some/list/directory/${local_part} `localuser': This director matches the local part of an address to a user of the machine. `smartuser': This dir. matches any local part. It can be used to pass messages for unknown users to a script that generates a helpful error message ========= Routers `domainlist:' This router searches a list of domains for the one it is trying to route. The list may either be a string in the configuration file, or a file, or both may be provided. `lookuphost:' This router looks up domain names `queryprogram:' This router passes the address to a command that runs in a separate process under an unprivileged uid and gid. ========= Transports `appendfile:' This local transport appends the message to a file whose name is specified as a string containing variable expansions. The current local part can be inserted via the expansion mechanism, and file names such as /home/${local_part}/inbox /var/mail/${local_part} `pipe': This local transport passes the message via a pipe to a specified command `smtp': This remote transport delivers a message using SMTP over TCP/IP. ===================================================== install cp src/EDITME Local/Makefile cp exim_monitor/EDITME Local/eximon.conf make su - make install find / -depth -name sendmail -print | xargs rm -f ln -si /usr/exim/bin/exim /usr/sbin/exim ln -si /usr/exim/bin/exim /usr/sbin/sendmail ln -si /usr/exim/bin/exim /usr/lib/sendmail ps | grep sendmail | awk '{print $1}' | xargs kill -9 /usr/sbin/exim -q30m -bd ===================================================== examples pop-before-smtp hack; duls (Dial ups) checking host_accept_relay = "127.0.0.1/32 : 147.28.0.0/16 : \ /usr/local/etc/exim/popauth" rbl_hosts = "!/usr/local/etc/exim/popauth:*" rbl_domains = rbl.maps.vix.com:dul.maps.vix.com:relays.mail-abuse.org www.exim.org/mailman/listinfo/pop-imap POP + IMAP ===================================================== anti SPAM rbl_reject_recipients = yes recipients_reject_except = dbm; /usr/exim/tables/rbl-opt-out cron job builds the list into a dbm from rbl-opt-out ------------------------------------------------ reject based on sender address sender_reject_recipients = @@lsearch*;/usr/exim316/blocked.senders prohibition_message = "${lookup{$prohibition_reason}lsearch {/usr/exim316/reject.messages}{${expand:$value}}}" ---------------------- file: blocked.senders send4fun.com * uuinc1smtp1.flonetwork.com * aol.com SuccessisGreat:Greatsuccess:Success101:Successisgood * admin__ ---------------------- file: reject.messages sender_reject: Get Lost - No Spammers Allowed Here|Contact postmaster\@example\.com host_accept_relay: Host $sender_fullhost not allowed to relay|through $primary_hostname|Contact postmaster\@example\.com ------------------------------------------------ sender_verify_hosts_callback = !10.0.0.0/8:!*.mydomain.com:/etc/mail/badsenders:* sender_verify_callback_domains = !mydomain.com:/etc/mail/baddomains:* sender_verify_callback_timeout = 90s ===================================================== mailq | \ perl -00 -ne 'if (/\*frozen\*/&&/addr/) {@x=split;print "$x[2]\n";}' |\ xargs /usr/sbin/exim -Mrm put your wanted regexp in place of "addr" - best try it first without the xargs phrase. ===================================================== VIRUS scan ====================================================== case insensitive, ignore extra white space - like perl's //ix, ignore # comments (?:Content- # start of content header (?:Type: \s* # rest of c/t header application/octet-stream # content-type |Disposition: \s* # content-disposition hdr attachment) # content-disposition ;\s* # space or newline (?:file)?name= # filename=/name= |begin \s+ [0-7]{3,4} \s+) # begin octal-mode (\"[^\"]+\.(?:vbs|vbe|wsh|js|jse)\" # quoted filename.ext |[\w.-]+\.(?:vbs|vbe|wsh|js|jse)) # unquoted filename.ext [\s;] [NB (?: is a non capturing bracket - so the filename ends up in $1 ] ====================================================== Many users virttransport: driver = appendfile group = mail user = someuser mode = 0660 mode_fail_narrower = false envelope_to_add = true file = /var/spool/mail/${local_part} # Director - this is the last-resort director, if a system user exists, virtuser: driver = smartuser local_parts = !.bin:!.etc require_files = /var/spool/mail/${local_part} transport = virttransport --------------------------------- localuser_pop: driver = accept condition = ${lookup \ {${lookup {$domain} lsearch {/etc/exim/prefixes}}-$local_part} \ lsearch {/etc/exim/mailusers} \ {yes}{no}} retry_use_local_part transport = local_delivery user = ${lookup \ {${lookup {$domain} lsearch {/etc/exim/prefixes}}-$local_part} \ lsearch {/etc/exim/mailusers} {$value} } ====================================================== virtual domains replace dbm with lsearch if you prefer a plain text file. Syntax is: *@yourdomain: user1 user2@yourdomain: user2 ... domains are in local_domains ........................... # router virtualuser: driver = accept condition = ${lookup{$local_part@$domain}dbm*@{/etc/exim/usermap.db}{yes}} transport = maildrop_pipe postmaster: driver = redirect local_parts = postmaster : abuse : hostmaster data = postmaster@ymmv.de cannot_route_message = Unknown user # transport maildrop_pipe: driver = pipe command = "/usr/bin/maildrop -d ${lookup{$local_part@$domain}dbm*@{/etc/exim/usermap.db}}" return_path_add envelope_to_add delivery_date_add check_string = "From " escape_string = ">From " group = mail ====================================================== --------------------------------- Makefile for exim.conf: exim: exim.conf exim.conf.auth exim.conf: exim.conf.master @echo "Rebuilding exim.conf from exim.conf.master" @chattr -i exim.conf @cp exim.conf.master exim.conf @chattr +i exim.conf exim.conf.auth: exim.conf.master @echo "Rebuilding exim.conf.auth from exim.conf.master" @chattr -i exim.conf.auth @sed "s/#AUTH //" < exim.conf.master > exim.conf.auth @chattr +i exim.conf.auth libdb4.3-dev needed for make ====================================================== alternative smarthosts # where the one to be used is determined by which ISP I'm connected to. # /etc/exim/exim.conf: Routers section smart_host: domains = /etc/exim/smart-domains driver = domainlist transport = remote_smtp search_type = lsearch* # ^^^^^--- Note the '*' here; perhaps that's what # Robin is missing.... route_file = /etc/exim/smart-hosts require_files = /etc/exim/use-smart-host 'require_files' allows me to select whether i want to use the smart_host router or not by touching or removing /etc/exim/use-smart-host. In /etc/exim/smart-domains: !*.my.local.domain * In /etc/exim/smart-hosts: *: my.ISPs.outgoing.mail.hub byname (I use 'byname' so that i can temporarily use a secondary outgoing mail hub if the main one isn't working, by adding the right IP address to /etc/hosts.) ====================================================== Virtual ======================= Filter message_size_limit = 300K This is indexed under "size limit" and "message size limit". ------------------------------------------------------ if $h_content-type: does not match "^$|doc|xls|txt" then fail "Silly security policy requires this message to be rejected." endif (The ^$ at the start matches an empty string - what you'll get if there isn't a Content-Type: header at all.) ======================== 2 domains /etc/exim.conf primary_hostname qualify_domain qualify_recipient receiver_unqualified_hosts local_domains relay_domains relay_domains_include_local_mx ------------------------- eximconfig ========================== MySQL (LDAP) >So, what I would like exim to do is to be able to do a LDAP or SQL lookup >during the SMTP negotiation phase (following the RCPT TO) to determine if >the recipient address is valid or not. Based on my research, using exim >4.x's ACL facility seems to be the best approach, but I'm a little unclear >on the proper syntax as the manual does not give any examples when using >LDAP or SQL. Should I be using the "recipients =
" >condition, or make up a custom "condition = " of my own? > >Any pointers would be much appreciated. deny message = Our domain, but user unknown domains = +localdomains !recipients = mysql;select 1 from users where \ email='$local_part@$domain' This should work when you place it in a strategic good way in your rcpt-acl (before any RBL-checks, etc.) =========================== Perl perl_alias: driver = smartuser new_address = ${perl{your_perl_subroutine}{${local_part}}{${domain}}} ---------------------------- handle vacation messg (need web access for virt) vacation_autoreply: debug_print = "R: vacation_autoreply for $local_part@$domain" driver = accept local_parts = /var/mail/vacation/is-away senders = ! /var/mail/vacation/no-autoreply-to transport = vacation_autoreply # don't stop routing (do deliver mail to recipient) unseen ============================ Eudora and TLS AUTH ---------------------------- Eudora.ini SSLSendVersion=6 SSLReceiveVersion=6 ============================ Exim in front of Exchange last two routers look like: exchangeProxyAddressesLookup: driver = redirect data = ${lookup ldap \ {ldap:///CN=Users,DC=EXAMPLE,DC=com?mail?sub?(proxyAddresses=SMTP:${quote_ldap:$local_ \ part}@${quote_ldap:$domain})}} domains = dbm;/etc/exim/db/localdomains.db verify_recipient self = pass pass_router = exchangeRoute no_more exchangeRoute: driver = manualroute transport = remote_smtp route_data = ${lookup{$domain}dbm{/etc/exim/db/localdomains.db}} where localdomains.db contains key/value pairs for the domain/ip address of the exchange server it is routed to. =============================== deny encrypted ZIP files deny message = Encrypted zip attachments are not allowed condition = ${if match{$message_body:}{ UEsDB....[Q-Za-fw-z0-9\+/]}{yes}{no}} =============================== process monitoring ----------------- /etc/monitrc # Global set-statements set init # set alert monit@cdmnet.org mail-format { from: monit@cdmnet.org } set daemon 180 set httpd port 2812 address localhost allow localhost allow root:XXXXX allow crypt /etc/monit/monit.passwd set logfile syslog facility log_daemon # exim mail daemon check process exim4 pidfile /var/run/exim4/exim.pid group mail start program = "/etc/init.d/exim4 start" stop program = "/etc/init.d/exim4 stop" if failed port 25 proto smtp then restart if 5 restarts within 5 cycles then timeout depends on clamd # ClamAV virus checking daemon - vital for exim check process clamd pidfile /var/run/clamav/clamd.pid group virus start program = "/etc/init.d/clamav-daemon start" stop program = "/etc/init.d/clamav-daemon stop" if failed unix /var/run/clamd.ctl send "PING\nQUIT\n" expect "PONG\n" timeout 10 seconds then restart if 5 restarts within 5 cycles then timeout # virus database updater check process freshclam pidfile /var/run/clamav/freshclam.pid group virus start program = "/etc/init.d/clamav-freshclam start" stop program = "/etc/init.d/clamav-freshclam stop" if 5 restarts within 5 cycles then timeout =============================== process queue run exim -d -qf 1D4O7X-0001dV-Vl 1D4O7X-0001dV-Vl 2>/tmp/debugout =============================== mailbox to Maildir #!/bin/sh # code by Renaud Allard mb2md -s /var/mail -d /tmp/Maildir ls /home | grep -v admin | while read user do mb2md -s /home/$user/mail -d /home/$user/Maildir rm -rf /home/$user/Maildir/cur /home/$user/Maildir/new /home/$user/Maildir/tmp mv /tmp/Maildir/.$user/* /home/$user/Maildir chown -R $user:$user /home/$user/Maildir done rm -rf /tmp/Maildir =============================== Calling my own app from an ACL http://www.exim.org/exim-html-4.50/doc/html/spec_11.html#IX853 ${run{ }{}{}} This requires starting a new process so if you need high performance it isn't the best way -- but it can work for small volume or testing purposes. If it is a listening daemon process you can use the readsocket (UNIX or INET sockets): ${readsocket{}{}{}{}{}}