Randall Shaw <[EMAIL PROTECTED]> writes:

> [ ... ]
>
> What we are attempting to solve, is killing those messages from being
> deferred and thus sitting in the mail queue with no hope of ever returning
> the failure notice to the original sender.

I came up with a hack to solve this exact problem.  I did it as follows.

First, I put the following line in my /etc/syslog.conf file:

  mail.info      |exec /usr/bin/nice -7 /usr/local/bin/mailLogger

The mailLogger script is written in Perl and routes and filters various
mail-related syslog messages that come to it via stdin.  Among other
things, it contains the following code

  
  while (defined(my $line = <STDIN>)) {
    chomp($line);
    # ... etc. ...
    if ($line =~ m/\bcouriersmtp:\s+id=(\S+?),.*:\s+deferred\s*$/) {
      my $id = $1;
      system("/usr/local/bin/maybeCancel $id 1>/dev/null 2>&1 &");
    }
    # ... etc. ...
  }

In other words, "deferred" lines that are written to syslog are filtered
as they are being output, and the queue ID is extracted from these
lines.  For each queue ID encountered, its value is passed to the
maybeCancel script.

Given this queue ID, the maybeCancel script locates the control file for
the message and reads it.  In this file is enough information to locate
the message file itself, and also to know how many send attempts have
been made, how long it's been queued, etc.

Based on all this info, the maybeCancel script decides whether or not it
should cancel that message.  If so, it runs Courier's cancelmsg program
to remove the message from the queue.

As I mentioned, this is a hack.  But it works fine for me.


> [ ... ]

-- 
 Lloyd Zusman
 [EMAIL PROTECTED]
 God bless you.



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to