>The email is being rejected by the recipient mail servers and sent back to
>an unknown user/s @ mydomain. Then the message that is being returned to
>notify that the email address is invalid is being returned to the postmaster
>address as undeliverable. So far today I have received 7000 + of these.
>
>I have gone through the message headers and thay are all from different
>domains to differnet unknown users etc with differnet subject lines.
this make it difficult to clean up, unless you can look at the body of the
messages and see some fixed string you can filter on.
>How do others deal with this sort of issue.
prevent it by having IMGate use check_recipient_maps (best) or
reject_unverified_recipient to reject msgs to unknown recipients
Since you haven't prevented it, you have to cleanup. One way is to reduce
the maximal_queue_lifetime to a small number, like 60s, so the
undeliverable bounce messages will expire/disappear quickly, then raise the
60s to 2h or whatever. This will also bounce/disappear non-deliverable
legit msgs, but the legit users can just resend the msg.
man postcat
man postsuper
>just allow them to be delivered
they aren't deliverable
>and then delete them perhaps?
Delete is another way to cleanup.
if you can identify a common PATTERN or two in the msgs, you can you this
to delete, from the postfix archive:
################################
I use the following to clean my spool in emergency situations where i HAVE
to get the spool size down (or when i receive a kazillan spams all with
yahoo as the forged from address). the commented out lines can be used to
troll thru a two layer structure of the spool dir. obviously replace
"PATTERN" with the pattern you want to delete with.
#!/usr/bin/perl
$| = 1;
$spool = "/var/spool/postfix";
@dirstocheck = ("active","deferred"); # can be advisable to include
"incoming" in this array.
foreach ( @dirstocheck ) {
$level1 = "$spool/$_";
print "CWD = $level1\n";
opendir(ROOTDIR,"$level1");
@DIR1 = readdir(ROOTDIR);
shift @DIR1; shift @DIR1;
foreach (@DIR1) {
$dir1 = $_;
#print "$_\t";
opendir(DIR1,"$level1/$dir1");
@DIR2 = readdir(DIR1);
shift @DIR2; shift @DIR2;
#foreach (@DIR2) {
# $dir2 = $_;
# #print "$_\t";
# opendir(DIR2,"$level1/$dir1/$dir2");
# print "$level1/$dir1/$dir2\n";
# @DIR3 = readdir(DIR2);
# shift @DIR3; shift @DIR3;
foreach (@DIR2) {
$dir3 = $_;
#print "$_\t";
#print "$dir1/$dir3\t";
open(CMD, "/usr/sbin/postcat $level1/$dir1/$dir3 |
grep PATTERN |");
print ".";
while (<CMD>) {
if (/PATTERN/) {
system "postsuper -d $dir3";
$Match++;
print "*";
last;
}
}
$Count++;
}
#}
}
print "\n\n";
}
print "\nTotal Files : $Count\nMatched Files: $Match\n";
##########################
There are shorter versions and non-perl versions around, maybe somebody
else here has other "clean the queue" scripts