Exim Cheatsheet

Here are some useful things to know for managing an Exim 4 server.
Show email queue:
exim -bpc

Show detailed exim process:
exiwhat

List email queue
exim -bp

SUMMARY

Summary of email queue:
exim -bp | exiqsumm

Generate statistic report from exim log:
eximstats /var/log/exim_mainlog > namafilebaru

Same as above, with less ouput:
eximstats -ne -nr -nt /var/log/exim_mainlog

Same as above, for certain date:
fgrep 2006-09-18 /var/log/exim_mainlog | eximstats

SEARCH QUERY

Search by sender:
exiqgrep -f someone@somedomain.com

Search by recipient:
exiqgrep -r someone@somedomain.com

Showing email ID by sender or recipient:
exiqgrep -if someone@somedomain.com
exiqgrep -ir someone@somedomain.com

Showing total email based on sender or recipient:
exiqgrep -cf someone@somedomain.com
exiqgrep -cr someone@somedomain.com

Showing all email IDs from queue:
exiqgrep -i

QUEUE MANAGEMENT

Starting queue:
exim -q -v

Starting queue of local sending:
exim -ql -v

Remove a mail from queue:
exim -Mrm message-id ...

Freez email:
root@localhost# exim -Mf <message-id> ...

Make an email sending faster:
exim -Mt message-id ...

Send only a certain email:
exim -M <message-id> ...

Force email to be failed (from sending) and returned:
exim -Mg <message-id> ...

Show email header:
exim -Mvh <message-id>

Show email subject:
exim -Mvb <message-id>

Show email log:
exim -Mvl <message-id>

Removing email based on keyword:
exim -Mrm `grep -lr 'fat loss product' /var/spool/exim/input/ | sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g'`

Removing 1000 emails which come from 1 email address:
exim -Mrm `exiqgrep -i -f 'someone@somedomain.com' | head -1000`

Removing emails which their subjects are “Mail delivery failed”
scansubject | grep "Mail delivery failed" | cut -f 1 -d " " | xargs exim -Mrm

MESSAGE-IDs AND SPOOL FILES

The message-IDs that Exim uses to refer to messages in its queue are mixed-case alpha-numeric, and take the form of: XXXXXX-YYYYYY-ZZ. Most commands related to managing the queue and logging use these message-ids.

There are three — count ‘em, THREE — files for each message in the spool directory. If you’re dealing with these files by hand, instead of using the appropriate exim commands as detailed below, make sure you get them all, and don’t leave Exim with remnants of messages in the queue.

Files in /var/spool/exim/msglog contain logging information for each message and are named the same as the message-id.

Files in /var/spool/exim/input are named after the message-id, plus a suffix denoting whether it is the envelope header (-H) or message data (-D).

These directories may contain further hashed subdirectories to deal with larger mail queues, so don’t expect everything to always appear directly in the top /var/spool/exim/input or /var/spool/exim/msglog directories; any searches or greps will need to be recursive. See if there is a proper way to do what you’re doing before working directly on the spool files.

QUEUE INFORMATION

Print a count of the messages in the queue:
exim -bpc

Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):
exim -bp

Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):
exim -bp | exiqsumm

Generate and display Exim stats from a logfile:
eximstats /path/to/exim_mainlog

Same as above, with less verbose output:
eximstats -ne -nr -nt /path/to/exim_mainlog

Same as above, for one particular day:
fgrep YYYY-MM-DD /path/to/exim_mainlog | eximstats

Print what Exim is doing right now:
exiwhat

ACCESS CONTROL

To set up access control list files, add the two lines below to exim.conf:
#!!# ACL that is used after the RCPT command
check_recipient:
# Exim 3 had no checking on -bs messages, so for compatibility
# we accept if the source is local SMTP (i.e. not over TCP/IP).
# We do this by testing for an empty sending host field.
accept hosts = :

Add appropriate entries to these files – hostnames/IP addresses to /etc/exim_reject_hosts, addresses to /etc/exim_reject_senders:
drop hosts = /etc/exim_reject_hosts
drop senders = /etc/exim_reject_senders

The Exim Specification – Version 4.5x
Documentation For Exim
The Exim Home Page

Source: Brad the Mad

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Trackbacks:0

Listed below are links to weblogs that reference
Exim Cheatsheet from Aji's Journal
TOP