LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 10-08-2008, 02:05 AM   #1
badboynick21
LQ Newbie
 
Registered: Jul 2008
Posts: 13

Rep: Reputation: 0
Post delete all mail with exactly same subject from postfix queue


Is there any script to do such thing like we can delete all mails with exactly one recipient...
 
Old 10-08-2008, 02:47 AM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Which do you want the mail Subject header as stated in this thread's subject, or mail recipient as stated in the post?
 
Old 10-08-2008, 04:15 AM   #3
badboynick21
LQ Newbie
 
Registered: Jul 2008
Posts: 13

Original Poster
Rep: Reputation: 0
mail Subject header ...
 
Old 10-08-2008, 04:53 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
This is not a good idea on a live system; there is no programmatic interface for you to use to access the postfix queue while postfix is running. You can stop Postfix, and then use postsuper to delete all offending messages.

...but the idea is here:

Code:
# change directory to postfix's queue directory
cd $(postconf -h queue_directory)/active
# loop over queue files
for i in * ; do 
   # postcat e file, grep for subject "test" and if found
   # run postsuper -d to delete queue'd message
   postcat $i |grep -q '^Subject: test' && echo postsuper -d $i
done
You can do similar for the hold and deferred directories, in a loop if desired. Remove the echo above to actually delete - currently the script only outputs what it would do.

Let me guess - is your queue filled up with backscatter for invalid recipients and your server is not doing recipient validation?

Last edited by Mr. C.; 10-08-2008 at 04:55 AM.
 
Old 10-08-2008, 05:12 AM   #5
badboynick21
LQ Newbie
 
Registered: Jul 2008
Posts: 13

Original Poster
Rep: Reputation: 0
no my mailman's is sending pending password reminder request of last two year so i just want to delete those mails from the queue and clear all the pending mails on mailing lists.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logging mail subject headers in Postfix timjames Linux - Software 1 03-20-2009 02:07 PM
problem with postfix, inbound mail stuck in queue csteel Linux - Newbie 1 07-03-2008 01:24 PM
Postfix Mail queue high inaki Linux - Software 3 02-13-2008 03:23 AM
Postfix mail queue problem csdhiman Linux - Server 1 08-07-2007 07:32 AM
delete mail from qmail queue hamish Linux - Software 1 06-05-2005 02:18 PM


All times are GMT -5. The time now is 11:54 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration