Szerző: Phil Pennock Dátum: Címzett: Matt CC: exim-users Tárgy: Re: [exim] Parsing Spool Files
On 2012-11-12 at 16:31 -0600, Matt wrote: > Perhaps there is an easier way to do this? I want a count of how many
> undelivered recipients in the queue for each "host_address" that has
> messages in the queue.
That will mis-fire every time Hotmail or Gmail has an outage. Probably
still worth looking at.
The last time I wrote scripts like this was a few employers back, around
2003/2004 time-frame, in NL. The company's gone so there's nobody to
ask for copyright release permission, even if I did have some lingering
backups.
Loosely speaking, assuming you're using something like Perl:
* invoke exim -bP spool_directory; take the value, tack "/input" onto
it
* invoke File::Find over that, calling a function on each file; note
that split_spool_directory means a recursive find is the way to go
* in that file, return immediately if the filename doesn't end in -H
* the message-id is then just the basename, less the -H suffix
* scan through the -key lines, stop on the first line not starting with
"-".
* match on -host_address; -localerror can be helpful if you want to use
things like bounces resulting from messages from a source IP, which
might be more reliable, as long as no senders are running a
mailing-list.
With File::Find and just creating a decent callback function to be
invoked on the files, it shouldn't be more than about 30 lines of
readable Perl.