List of useful commands to manage Exim mail server

The mailserver installed on your HostPapa VPS is called Exim. While the mailserver generally requires little interaction for those sending or receiving average volumes of email, there may be times when you wish to manage Exim’s settings.

To do so, first log in to your server in a terminal client using secure shell (SSH). Use the following commands to work with Exim.

Display the number of email messages in the queue

exim -bpc

Display information about email messages in the queue

exim -bp

Displays time queued, size, message-id, sender and recipient.

Display a summary of messages in the queue

exim -bp | exiqsumm 

Displays count, volume, oldest, newest, domain, and totals.

Display Exim’s current activity



Test Exim SMTP transaction

exim -bh ipaddress 

Spoofs an SMTP transaction, emanating from ipaddress. Exim’s status will be displayed as the transaction runs. Note that the message will not be delivered.

SMTP transaction

Display Exim settings

exim -bP

Exim settings

Search the mail queue for messages from a specific sender

exiqgrep -f [luser]@domain

Search the mail queue for messages from a specific recipient or domain

exiqgrep -r [luser]@domain

Display messages older than a specified number of seconds

exiqgrep -o seconds [...]

Display messages newer than a specified number of seconds 

exiqgrep -y seconds [...]

Locate messages matching a specific size

exiqgrep -s '^4..$' [...]

For example, 400-499 bytes. Use -z to match only frozen messages, or -x to match only unfrozen messages. To display just the message-id, use -I, while -c displays the message count.

Display the message count of the mail queue 

exiqgrep -c ...

Start a queue run

[email protected]# exim -q -v

Start a queue run isolated to local deliveries

[email protected]# exim -ql -v

Remove a message from the queue 

[email protected]# exim -Mrm <message-id> [ <message-id> ... ]

Freeze a message

[email protected]# exim -Mf <message-id> [ <message-id> ... ]

Throw a message

[email protected]# exim -Mt <message-id> [ <message-id> ... ]

Deliver a message

[email protected]# exim -M <message-id> [ <message-id> ... ]

Deliver a message (if the retry time has been reached) 

[email protected]# exim -Mc <message-id> [ <message-id> ... ]

Force a message to fail

[email protected]# exim -Mg <message-id> [ <message-id> ... ]

Remove all frozen messages

[email protected]# exiqgrep -z -i | xargs exim -Mrm

Remove all messages older than a defined number of seconds

[email protected]# exiqgrep -o seconds -i | xargs exim -Mrm

Freeze All Queued Mail from a Named Sender

[email protected]# exiqgrep -i -f [email protected]| xargs exim -Mf

View a message’s mail headers

[email protected]# exim -Mvh <message-id>

View a message’s body

[email protected]# exim -Mvb <message-id>

View a message’s logs 

[email protected]# exim -Mvl <message-id> 

Add a recipient to a message

[email protected]# exim -Mar <message-id> <address> [ <address> ... ]

Edit a message sender

[email protected]# exim -Mes <message-id> <address>

If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.


Was this article helpful?


Related Articles

Leave A Comment?