SOLVED Count total number of emails in queue with a specific subject line?

000

Well-Known Member
Jun 3, 2008
270
12
68
Hello.

I only find
Code:
exiqgrep -i |awk '{ print "exim -Mvh "$1 }' |sh |grep -i 'here subject EXACT'
but please, how I can count the number of emails in queue with "*some string in subject*" ??

After of I know the number total, then I want please the line/command to remove this emails in queue filtering by "*some string in subject*", no by "*some string in BODY*" in body.

is possible?


Thanks
 

Muhammed Fasal

Well-Known Member
Aug 9, 2017
54
10
8
India
cPanel Access Level
Root Administrator
I guess this should work to get what you are expecting here:

- To get the count of emails in queue with a specific subject:
Code:
exiqgrep -i | awk '{print "exim -Mvh "$1}' | sh | grep "Subject:" | awk -F"Subject:" '{print $2}' | grep -c "STRING YOU WISH TO MATCH"
- To remove the emails matches with a subject from queue:

Code:
grep -lri "STRING YOU WISH TO MATCH" /var/spool/exim/ | grep input | cut -d"/" -f7 | awk -F"-" '{print $1"-"$2"-"$3}' | uniq -c | awk '{print $2}' | xargs exim -Mrm
 
  • Like
Reactions: verdon