Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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);
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.