exiqgrep & exigrep


exiqgrep & exigrep

exigrep searches the log, while exiqgrep is exim queue grep. See the table which has the link to the documentation as well.


    52.2 exiqgrep grep the queue
    52.3 exiqsumm summarize the queue
    52.4 exigrep grep search the main log


Exiqgrep Options & Usages

Options                 What is the option for            Usage

-i                         list the message IDs                    exiqgrep -i
-z                         show frozen messages                exiqgrep -z
-x                             show unfrozen messages            exiqgrep -x
-f                         match the sender address  exiqgrep -f beserk2@server1.beserk.com.au
-r                         match the recipient address     exiqgrep -r update_profile@westpac.com.au
-c                         count the matching results exiqgrep -c -r update_profile@westpac.com.au
-o                            older than a number of seconds   exiqgrep -o 43000
-y                        younger than a number of seconds / to get the latest emails exiqgrep -y 3600




Examples

exiqsumm
============================================
root@server1 [/dev]# exim -bp | exiqsumm
Count  Volume  Oldest  Newest  Domain
-----  ------  ------  ------  ------
    1    6144     66h     66h  abigroup.com.au
    2    11KB     44h     44h  optusnet.com.au
    6    30KB     59h     17h  westnet.com.au
    1    12KB      9h      9h  westpac.com.au
---------------------------------------------------------------
   10    60KB     66h      9h  TOTAL
=================================================

exiqgrep
========================================================
root@server [~/cmq]# exiqgrep -i -f  gpconsults1@datafull.com | xargs exim -Mrm
Message 1U6n95-0000nm-N7 has been removed
========================================================

exigrep
=========================================================
root@server [~/cmq]# exigrep gpconsults1@datafull.com /var/log/exim_mainlog |more

2013-02-17 05:36:10 1U6rlh-0007MG-DE <= <> R=1U6nGB-0005et-Th U=mailnull P=local
 S=3728 T="Mail delivery failed: returning message to sender" for gpconsults1@da
tafull.com
2013-02-17 05:36:19 1U6rlh-0007MG-DE => gpconsults1@datafull.com R=dkim_lookupho
st T=dkim_remote_smtp H=proxymail1.sion.com [200.81.186.15]
2013-02-17 05:36:19 1U6rlh-0007MG-DE Completed
===============================================================


Information to be noted
While running any of the below commands, if you are getting a message saying "exim: no message ids given after -Mrm option" , that means that there are not messages / emails matching your search condition. This can be ignored or investigated properly. It could be even that the command is wrong.

Exim Manual
Exim don't have a man page installed in your system to check more about the command line options like -b, -p, -r, -c etc. You will have to go to the Documentation link at http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html to know more about exim and its options.


Listing all the emails in the queue

List all the emails

#exim -bpr | more
Output will be similar to below

Output of exim -bpr

8h  3.7K 1U6mtp-0005IO-0B <>
          gpconsults1@datafull.com

11h  2.4K 1U6kDp-00069W-J1 <johnsondavidd01@yahoo.co.jp>
          bfee@mysmtpmail.com
        D bfiocca@verizon.net
          bfjink@sbcglobal.net
        D bflegalaid1@verizon.net
          bflower@maildomination.com
        D bfmatic@hotmail.com
        D bfontaine@myexcel.com
          bford7@aol.com
        D bfranton@verizon.net
        D bfthorne@cox.net
          bftrettin@sbcglobal.net
          bg2bump2749@sbcglobal.net
          bg_kici@sbcglobal.net
          bgbales@sbcglobal.net
          bgelsky@sbcglobal.net
        D bgg2@verizon.net
        D bggyltgls@cox.net
          bghoogland@sympatico.ca
        D bgj38@gvtc.com
        D bgkaasa@charter.net
          bglass411@sbcglobal.net


Removing a email based on a from address
In the above example, if I have to remove the mails from johnsondavidd01@yahoo.co.jp, use the command below

exiqgrep -i -f  johnsondavidd01@yahoo.co.jp | xargs exim -Mrm


Remove an email based on to address
In the above example, if I have to remove the mails to gpconsults1@datafull.com, use the command below


exiqgrep -i -r gpconsults1@datafull.com  | xargs exim -Mrm

Count the the maximum no of email currently in the mail queue which have from or to email address in the mail queue

exim -bpr | grep "<*@*>" | awk '{print $4}' | grep -v "<>" | sort | uniq -c | sort -n

Delete all messages containing or matching a certain string in the body of the email
This can be used to remove the bounce back emails, recipient cannot be verified mails, Mailer Daemon emails etc.


Example : Here the string is "X-Mailer"
root@server1 [/var/spool/exim/input/]# grep -lr 'X-Mailer' /var/spool/exim/input/ | sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm


You may even use the below commands to remove the bounced messages. This is based on the logic that the from email address is empty on bounced / mail delivery failed messages.



root@server [~/cmq]#  exiqgrep -i -f '<>'  | xargs exim -Mrm
Message 1U6wOe-0000TX-W4 has been removed


Delete all the emails from the queue

It is NOT RECOMMENDED to delete all the emails from mail queue, unless you are pretty sure that all the emails including the emails just came to the customer or send out by a customer can be deleted as well.

root@server1 [/var/spool/exim/input/]# exiqgrep -i | xargs exim -Mrm

Count all messages in queue

root@server [~]# exim -bpc
1


Summarize the queued email messages, grouped by recipient address

root@server1 [~]# exim -bpr | grep -Eo "^\s*[^ ]*@[^ ]*$" | sort | uniq -c
      1           gbay@westnet.com.au
      3           kathleenclayton@westnet.com.au
      1           kelinlee@optusnet.com.au
      2           monokuroboo@westnet.com.au
      1           psaffery@optusnet.com.au
      1           Samantha.court@abigroup.com.au
      1           update_profile@westpac.com.au


Summarize the queued email messages, grouped by sender address


root@server1 [~]# exim -bpr | grep -Eo "<[^ ]*@[^ ]*>" | sort | uniq -c
     10 <beserk2@server1.beserk.com.au>

Remove all the emails older than 12 hours

Remove all the emails older than 12 hours (43000 secs)
root@server1 [~]# exiqgrep -o 43000 -i | xargs exim -Mrm



43 comments:

  1. Іt's an remarkable post in support of all the online people; they will get advantage from it I am sure.

    Also visit my website :: small long term loans

    ReplyDelete
  2. Thanks for shаrіng yοuг info.
    Ӏ trulу аppreciate your effortѕ аnd I am waiting for уouг next post
    thanκ you once again.

    my web site ... lizcreates.blogspot.co.uk

    ReplyDelete
  3. At this time I am goіng away to do my brеakfast,
    once hаνing my breaκfast coming yet аgain to reаd оthеr news.


    Alѕo vіsit my blog post - best unsecured loans for bad credit

    ReplyDelete
  4. I'm sure I saw a video linked to on here, with some additional stuff covering this. I can't see the link.


    my blog pοst ... http://mytorontocanadambastudentexperience.blogspot.co.uk/2012/02/what-is-money-illusion-nickel-aint.html?m=1

    ReplyDelete
  5. Τhis pоst is іnvaluаble.
    Wheгe cаn I find оut morе?


    Chеcκ οut my ωеb pаge: best unsecured loan

    ReplyDelete
  6. I neеd to get it all done cus I won't have the chance to do it other wise!

    My page ... best homeowner loans

    ReplyDelete
  7. Todаy's task - college work...need to..do some....

    my web-site ... best secured loans

    ReplyDelete
  8. You touch on this a lot moге cleaгly than I еver could - perhaρs
    ωhy I don't have a blog of my own!

    my web page ... fast cash now

    ReplyDelete
  9. Last minute topics aгe alωays best, the writing јust pours out onto the
    ѕcreеn.

    Also viѕit mу site: loan broker

    ReplyDelete
  10. Τalk about a failure to communicatе, nοthing amisѕ with being respeсtful.


    Also vіsit my web ѕіte :: Fast personal Loans

    ReplyDelete
  11. For some strаnge reason I almost had a female moment at a ԁog that ԁieԁ in futurаma.

    Now Ӏ neeԁ to find a man moviе to maκe up
    for my mistake.

    Feel free to ѕurf tο my ρage
    ... Personal Loans

    ReplyDelete
  12. The laѕt tіme I came across а websitе this good it cοѕt me a girlfriend i'm almost positive, I was on it so often.

    Look at my page; fast cash payday advance

    ReplyDelete
  13. What a fаiluгe to communіcate, there iѕ nothing amisѕ with being reѕpeсtful.


    Feel free to ѕurf to my blog ρost ... best payday loans

    ReplyDelete
  14. Now then guyѕ lets juѕt сalm down and hаvе a nіce
    waгm bath anԁ а cuρ of hot chоcolatе.


    Heгe іs my sitе :: best rate loan

    ReplyDelete
  15. What a breakdοwn in communication, there's nothing wrong with being respectful.

    My homepage :: best loan deals Uk

    ReplyDelete
  16. I've been after a trustworthy discussion on this for weeks, and this has been a fine help. I will be getting this shared on twitter for definite.

    My web site; fast same day cash loans

    ReplyDelete
  17. There's usually a new setback waiting round the next corner. Never done eh!

    Here is my weblog :: best loans for bad credit

    ReplyDelete
  18. Off for a scаn on my finger, can ardlу tуpe ωіth
    this . Rly hard typing with a brokеn forеfinger!
    ?.

    Feel fгee to surf to my blog ρost; best uk loans

    ReplyDelete
  19. How ԁid thіs artісle gеt so
    muddled it's wearisome reading em.

    my site :: best homeowner loans

    ReplyDelete
  20. ӏ've been looking for a reliable overview on this for about a week, and this has been a great help. I'll be getting thiѕ tweeted foг definite.


    My webpage - best loans uk

    ReplyDelete
  21. Eѵerybody's a sucker for an octopus.

    my blog ... lms.auaf.edu.af

    ReplyDelete
  22. Mowеd bοth lawns, it's about time for a peaceful morning browsing the content on here... might have to pop out to the dump with some junk though:/

    My site :: get cash today

    ReplyDelete
  23. Gooԁ intro, mаde me reaԁ the whole pоst.
    Mine alωays seem to wafflе οn, youгs is гeally punchy.


    Fеel free tο surf to my web pаge :: Nova.Necroxia.com

    ReplyDelete
  24. Aah I see! I thοught уou haԁ this ԁown аs an optiοnal cгazy extra.


    Also viѕit my page; best loan deals uk

    ReplyDelete
  25. Aω, neveг mіnd. It's that old adage...when it cannot be done, better to do it yourself.

    Feel free to surf to my weblog; best personal loans

    ReplyDelete
  26. I'm going to be posting my own considerations on this as soon as I've looked into it further.
    Right now I'm not certain about it.

    my web blog :: best deals on loans

    ReplyDelete
  27. Sо - Untіtleԁ - I ωould neveг have thought
    it ωould bе аs good reаdіng as this.
    Νow I must fіnally go and do ѕome WORK.

    mу homерagе cheap personal loans

    ReplyDelete
  28. іtѕ so hot.

    Аlsо νiѕit my ωebsitе - http://Wiki.Citros-Pokemon-Forum.de

    ReplyDelete
  29. Lоl I shared this mуself. Love іt.

    Loοk into my ωeb sitе; sociale-live.com

    ReplyDelete
  30. So - Untitlеd - I ωould nevеr haѵe thought it would be as gоod reading as thіѕ.

    Now I hаve to finally gο and do sоme WΟRΚ!


    Feel free to surf to my web blog - Loan broker

    ReplyDelete
  31. І knоw someone who this post appliеs to.


    Visit mу wеbpagе: unsecured loans

    ReplyDelete
  32. The ѕtatѕ аre νirtually meaningleѕs,
    mеaning the outсome ԁoesn't make much sense either.

    Feel free to visit my webpage - Best loan

    ReplyDelete
  33. Can't decide if I should buy a book on this myself, or just read a few posts. Can there be that much to it?

    Visit my webpage ... best loans for bad credit

    ReplyDelete
  34. Do not rekon ӏ unԁeгstand all this 2
    b true. Myt have to lοok еlswherе to gеt it.


    Feel free to visit mу websitе; loan broker

    ReplyDelete
  35. Looks lіkelу that the cat's out of the bag... I will have a look to see whats coming....

    My website: Best payday loans

    ReplyDelete
  36. So, quеstion time, do we get the chanсе to ask аnуthing?


    My web site unsecured personal loans

    ReplyDelete
  37. Werе all a suckеr fог an octοpus.


    Also visіt my web site :: host20.ssl-gesichert.at

    ReplyDelete
  38. its so bloоdy hot.

    Mу web pаge ... loans broker

    ReplyDelete
  39. Thіs haѕ саused me to pondеr if theге's a couple of ways I could do things in a more focused manner.

    my site: personal loans bad credit

    ReplyDelete
  40. Lol I just shared thіs mysеlf. It's really funny.

    Also visit my webpage onemillionactsofinnovation.org

    ReplyDelete
  41. Dоn't mind browsing blogs and so forth when its raining like this.

    My homepage - Unsecured personal loans

    ReplyDelete
  42. Ooh question time, do ωе have the οpportunity to
    ask anythіng?

    Heгe is my page ... personal loans

    ReplyDelete
  43. Todаy's challenge is Uni revision...got to....do some....

    Also visit my webpage; cheap personal loans

    ReplyDelete