LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   POSTFIX Script (https://www.linuxquestions.org/questions/linux-server-73/postfix-script-598123/)

carlosinfl 11-08-2007 01:49 PM

POSTFIX Script
 
Guys - I was reading the "Postfix" book and found this following script below but I ran it and it showed the following on my server after I ran it...

Code:

[root@mail ~]# delete-from-mailq MAILER-DAEMON
................
postsuper: 5E3ED6C4FA: removed
postsuper: Deleted: 305 messages

So now my question is I don't really understand what the script did and what it basis the deletion from? I can understand that I deleted everything stuck in the queue being sent from "MAILER-DAEMON" but I don't know if I want to delete emails sent from him or what. I do agree that doing this individually by message ID would take way too long. Do I want to remove all messages sent from MAILER-DAEMON stuck in the queue?

Here is the script:

#!/usr/bin/perl
$REGEXP = shift || die "no email-address given (regexp-style, e.g. bl.*\@yahoo.com)!";
@data = qx</usr/sbin/postqueue -p>;
for (@data) {
if (/^(\w+)(\*|\!)?\s/) {
$queue_id = $1;
}
if($queue_id) {
if (/$REGEXP/i) {
$Q{$queue_id} = 1;
$queue_id = "";
}
}
}
#open(POSTSUPER,"|cat") || die "couldn't open postsuper" ;
open(POSTSUPER,"|postsuper -d -") || die "couldn't open postsuper" ;
foreach (keys %Q) {
print POSTSUPER "$_\n";
};
close(POSTSUPER);

acid_kewpie 11-10-2007 01:32 AM

MAILER-DAEMON is an internal name used by postfix to tell you about failures of mail delivery. by email. so you can easily have failing emails to tell you about other emails failing... which is nice.

thanks for the script btw, i actually needed it yesterday... bizarre coincidence.

carlosinfl 11-13-2007 12:06 PM

So I am still confused. Should I or should I not be removing emails stuck or queued from MAILER-D?

billymayday 11-13-2007 01:25 PM

You probably need to have a look at some of the messages and make up your own mind.

My guess is that you're bouncing spam to undeliverable addresses that were spoofed in the first place, in which case you would get rid of them and also consider you settings that are causing the bounces


All times are GMT -5. The time now is 06:31 AM.