Re: Too many mailer daemon notices
* On 2004.07.07, in <20040707163432.GJ32266@xxxxxxxxxxxxxxxxxxxxxx>,
* "Ben Damm" <bdamm-mutt@xxxxxxxxxxxx> wrote:
>
> What I'd like to do is make a list of everyone I send mail to, then
> have procmail drop the mailer daemon notices that contain no relevant
> email address. I was looking in the mutt manual for a way to process
> mail just before it is sent so I could make such a list, but no solution
> jumped out at me.
The trick with such problems is to set $sendmail to a filter that
subsequently invokes sendmail (or whatever). For example:
set sendmail=/path/to/filter
Attached is a filter that does something simmilar to what you want.
--
-D. dgc@xxxxxxxxxxxx NSIT::ENSS
No money, no book. No book, no study. No study, no pass.
No pass, no graduate. No graduate, no job. No job, no money.
T h e U n i v e r s i t y o f C h i c a g o
#!/usr/bin/env perl
## Customize
$real_sendmail = "/usr/lib/sendmail -oi -oem";
$addrsfile = $ENV{HOME} . "/.addrs";
## Find separation between DSN options and dst addresses
($index) = grep {$ARGV[$_] eq "--";} (0 .. $#ARGV);
## Separate options and addrs
@opts = splice(@ARGV, 0, $index);
@addrs = splice(@ARGV, 1);
## Invoke sendmail, copying input to pipe. Save status.
$cmd = join(" ", $real_sendmail, @opts, "--", @addrs);
if (open(SENDMAIL, "| $cmd")) {
print SENDMAIL <STDIN>;
close(SENDMAIL);
$rc = $?;
}
else {
$rc = 1;
}
## Write addrs to save file
open(ADDRS, ">>$addrsfile");
map { print ADDRS "$_\n"; } @addrs;
close(ADDRS);
## -
exit($rc);