Aller au contenu
Infogérance Linux Debian en France

Infogérance Linux Debian en France

Kogitae : Ingéniérie de l'hébergement Internet

  • Accueil
  • Parcours
  • Presse
  • Portfolio
  • Blog

Postfix Flush the Mail Queue

  • Accueil » Blog » Postfix Flush the Mail Queue
Danspostfix

Postfix Flush the Mail Queue

Traditionally you use the « sendmail -q » command to flush mail queue under Sendmail MTA. Under Postfix MTA, just enter the following command to flush the mail queue:

# postfix flush

OR

# postfix -f

To see mail queue, enter:

# mailq

To remove all mail from the queue, enter:

# postsuper -d ALL

To remove all mails in the deferred queue, enter:

# postsuper -d ALL deferred

postfix-delete.pl script

Following script deletes all mail from the mailq which matches the regular expression specified as the first argument (Credit: ??? – I found it on old good newsgroup)

#!/usr/bin/perl

$REGEXP = shift || die « no email-adress 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);

For example, delete all queued messages from or to the domain called fackspamdomain.com, enter:

./postfix-delete.pl fackspamdomain.com

Delete all queued messages that contain the word « xyz » in the e-mail address:

./postfix-delete.pl xyz

viaPostfix Flush the Mail Queue.

drop flush flush-mail-queue lamp-or-linux-or-developpement-web-and-apache-or-php-or-mysql-or-adobe-or-eclipse-or-zend-or-mozilla-or-firefox logwatch-mail-queue mail mysql postfix postfix-delete-mail-in-queue postfix-flush postfix-flush-queue postfix-queue-debian postfix-rediriger-mail-dans-la-queue postfix-resend-queue postfixflush purge queue script-mail-queue-del sendmail-flush sendmail-mqueue-resend

Étiquettes

administrateur-systeme-freelance (9) amazon (3) apache (14) asterisk (9) auth (3) bash (6) blog-administrateur-systeme (14) blog-administration-systeme (4) collectd (5) cpu (3) debian (30) dovecot (4) duplicate (3) f (6) freelance-asterisk (3) google (3) infogerance-linux (5) infogérance (4) ipv6 (7) kernel (4) kogitae (30) kogitae-com (3) kogitae-fr (6) lamp-or-linux-or-developpement-web-and-apache-or-php-or-mysql-or-adobe-or-eclipse-or-zend-or-mozilla-or-firefox (17) lenny (4) lighttpd (5) limit (4) linux (26) mail (7) mdadm (6) mysql (14) openvz (9) optimiser (4) php (5) postfix (11) privvmpages-openvz (3) pxe (3) raid (3) SEO (5) ssh (8) ssl (3) test (3) voip (4) wordpress (6) www-kogitae-fr (7)