Exim Command-line

Exim has many command-line arguments, which can be categorized as below

Input Mode Control Options to start processes for receiving incoming messages
Additional Message Data Options to supply information to be incorperated into an incoming message that has been locally submitted
Immediate Delivery Control Options to control whether a locally submitted message is delivered immediately on arrival, possibly depending on the type of recipient addresses
Error Reporting Options to control how errors in a locally submitted message are reported
Queue Runner Processes Options for starting queue runners and selecting which messages they process
Configuration Overrides Options for overriding the normal configuration file
Watching Exim Options for inspecting messages on the queue
Message Control Options for forcing deliveries and doing other things to messages
Testing Options for testing address handling, filter files, string expansion and retry rules
Debugging Options for debugging Exim and its configuration file
Internal Options that are only useful when one instance of Exim calls another (not discussed)
Compatibility with Sendmail Options that are recognised because they are used by Sendmail, but do nothing in Exim (not discussed)

Input Mode Control

Starting a daemon process

Start listening process

# exim -bd                # start an Exim daemon process on default port 25

# exim -bd -oX 1225       # start an Exim daemon process on port 1225

Interactive SMTP reception

SMTP on stdin and stdout, from local process or via inetd

# exim -bs

Batched SMTP

Batched SMTP from local process

# exim -bS

Extracting recipients from header lines

Message on standard input, recipients from header lines

# exim -t
From: paul.valle@datadisk.co.uk
To: complaints@datadisk.co.uk
Bcc: customerservice@datadisk.co.uk
.                           # finish with a single dot

Set SMTP timeout

Set SMTP timeout (overrides option smtp_receive_timeout)

# exim -os

Additional Message Data

sender address supplies the senders address overriding the address computed from the users login name

# exim -f angrycustomer@datadisk.co.uk compliants@datadisk.co.uk
Override the username

The gecos field is normally used to supply the username, but this can be overriden

# exim -F 'The Boss' paul.valle@datadisk.co.uk

Changing the characteristics for a message

There are a number of options starting with -oM that change the characteristics of a message

-oMa   sets the field that contains the IP address of the remote host
-oMaa  sets the field that contains the authenicator name, makes the message look like its authenicated
-oMai  sets the authenicated id value
-oMas  sets the authenicated sender value
-oMi   sets the fields that holds the IP address of the i/f on the local host that was used
-oMr   sets the protocol used to received the mesage (useful for logging)
-oMs   sets the field that holds the verified name of the remote host
-oMt   sets the field that holds the id string obtained by an RFC1413 callback to the sending host

Immediate Delivery Control

request background delivery

The accepting process automatically starts a delivery for each message received

# exim -odb

Wait until a delivery process has finished

Exim will create a new delivery process but will wait until it completes before proceeding

# exim -odf
# exim -odi

Place messages on the queue Exim normally tries to deliver the message ASAP, but you can place the message on the queue first

# exim -odq
Place SMTP on queues but deliver local ASAP You can place SMTP messages on a queue but send local deliveries ASAP

# exim -odqs

Error Reporting

Report an error by sending a message # exim -oem
Report an error by sending a message but different error code # exim -oee
Report error by writing a message to the standard error stream # exim -oep

Queue Runner Processes

start a queue runner process

Queue runner processes are normally started periodically by the daemon but you can do it manually

# exim -q

overriding retry times and freezing

Normally a queue runner process only unfrozen messages and addresses whose retry times have been reached but using the option below means all messages will be tried

# exim -qff

Local deliveries only

Process all unfrozen messages, and does local deliveries but skips remote deliveries

# exim -ql         # only local deliveries
# exim -qfl        # local and force for all addresses even if the retry limit has not been meet
# exim -qffl       # local, force and frozen messages (thawed)

Configuration Overrides

use specific configuration file # exim -C /etc/exim/test_exim_config
Override defined macros

# exim -D LOG_SELECTOR=+filter ...

Note: you can use upto 10 -D

Watching Exim

Display number of messages on the queue # exim -bpc
Display the complete queue # exim -bp

Message Control

Create a delivery process for specific message # exim -M 1G4K8N-0003uY-29
Freeze and thaw messages # exim -Mf 1G4K8N-0003uY-29          # Freeze message

# exim -Mt 1G4K8N-0003uY-29          # Thaw message
Abandon Messages # exim -Mg 1G4K8N-0003uY-29          # give up and generate a bounce message

# exim -Mrm 1G4K8N-0003uY-29         # give up but DO NOT generate a bounce message
Inspect a queued message # exim -Mvb 1G4K8N-0003uY-29         # view message body

# exim -Mvh 1G4K8N-0003uY-29         # view message header

# exim -Mvl 1G4K8N-0003uY-29         # view message log
Modify a queued message # exim -Mar 1G4K8N-0003uY-29 paul.valle@datadisk.co.uk        # Add recipient

# exim -Mes 1G4K8N-0003uY-29 paul.valle@datadisk.co.uk        # Edit sender

# exim -Mmad 1G4K8N-0003uY-29                                 # Mark all delivered

# exim -Mmd 1G4K8N-0003uY-29 paul.valle@datadisk.co.uk        # Mark delivered (just the address)


Testing the config settings

You can obtain lots of information using this command (version, authenicators, lookups, etc)

# exim -bV

Display specific options from the config file

# exim -bP router_list

Other options:


Testing routing

You get back information on what router, transport was used, type of lookup, etc

# exim -bt paul.valle@datadisk.co.uk

Verify an address

# exim -bv paul.valle@datadisk.co.uk

# exim -bvs paul.valle@datadisk.co.uk

Note: -bvs will only be different if option verify_sender and verify_recipient have been set

Start a fake SMTP connection # exim -bh              # starts a interactive SMTP session
Testing retry rules

# exim -brt datadisk.co.uk

Note: brush up on the syntax for the retry rules see delivery errors

Testing rewrite rules

# exim -brw paul.valle@datadiskcorp.co.uk

Note: more information can be seen at Address Rewriting
Testing filter files

# exim -bf new-filter < test-message
# exim -bvf new-filter < test-message                                ## adding verbose
# exim -bf new-filter -f paul.valle@datadisk.co.uk < test-message    ## specify the sender
# exim -bF system-filter < test-message                              ## test a system filter

Note: more information can be seen at Message Filtering

Testing string expansion # exim -be
> ${lookup {root} lsearch{/etc/passwd}}
x:0:1:Super User:/:/bin/sh



Start a interactive debugging session

# exim -d-all+filter -f paul.valle@datadisk.co.uk complaints@datadisk.co.uk

Note: plus means add debug information for specific option minus means do not debug for that option (see options below)

Debugging Selectors
acl ACL interpretation
auth Authenication
deliver General delivery logic
dns DNS lookups
dnsbl DNS black list code
exec Arguments for exec()
expand Details of string expansion
filter Filter handling
hints_lookup Hints data lookup
host_lookup All types of name-to-IP address handling
ident ident lookups
interface Lists of local interfaces
lists Matching things in lists
load System load checks
local_scan Debugging in the local_scan() function
lookup General lookup code and all lookups
memory Memory handling
pid Add pid to debug lines
process_info Setting info for the process log
queue_run Queue runs
receive General message reception logic
resolver The DNS resolver's debugging output
retry Retry handling
rewrite Address rewriting
route Address routing
timestamp Timestamp debug lines
tls TLS logic
transport Transports
uid Change of uid/gid and looking up uid/gid
verify Address verification
all All of the above and also -v output