Skip to content

tomahc/postfix-postq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

usage: postq queue [-h] [-o time [time ...]] [-s sender] [-r recipient] [-g {sender,rcpt}] [-i filename] [-p] [-e]

positional arguments:
  queue                                            Select a queue

optional arguments:
  -h, --help                                       show this help message and exit
  -o time [time ...], --older time [time ...]      Valid format is: d|h|m|s
  -s sender, --sender sender
  -r recipient, --rcpt recipient
  -g {sender,rcpt}, --group {sender,rcpt}
  -f filename, --filename filename                 Read postqueue output from file
  -p, --print           					       Print IDs instead
  -e, --errors          					       Show error messages

I was pretty much annoyed to create ridiculous chains of grep and awk commands over and over again. So I decided to build this script, where I can easily find the IDs I am looking for.

postq can group its output by sender and rcpt, give you the error messages and return IDs as stdin for postsuper.

  • --rcpt and --sender has full regex support
  • --group always defaults to sender
Searching for messages which are older than --older

--older arguments are more or less like those passed to date -d in a shorter notation:

  • Todo: passing a datetime

postq all --older 3d 2h 11m

Example Output

postq all -f postqueue.example

[email protected]
  AFC351AC602A - Mon Feb 16 07:05:26
     [email protected]
  AFC351AC602A - Mon Feb 16 07:05:26
     [email protected]
------------------------------
MAILER-DAEMON
   7C0C313C0C7 - Mon Jan 26 05:56:53
     [email protected]
------------------------------
[email protected]
   9C2AB13C0BE - Fri Jan 30 14:52:13
     [email protected]
    E7688DE3FA - Wed Feb 11 15:31:03
     [email protected], [email protected]
------------------------------
[email protected]
   DD6C66A8064 - Mon Dec  1 17:18:29
     [email protected], [email protected], [email protected]
------------------------------
with --errors
  • Todo: regex matching
[email protected]
  AFC351AC602A - Mon Feb 16 07:05:26
     [email protected]
      (connect to mx.random.net[999.888.777.666]:25: Connection timed out)
  AFC351AC602A - Mon Feb 16 07:05:26
     [email protected]
      (connect to mx2.random.net[888.721.412.123]:25: Connection timed out)
------------------------------
MAILER-DAEMON
   7C0C313C0C7 - Mon Jan 26 05:56:53
     [email protected]
      (Host or domain name not found. Name service error for name=notexistant.com type=MX: Host not found, try again)
------------------------------
[email protected]
   9C2AB13C0BE - Fri Jan 30 14:52:13
     [email protected]
    E7688DE3FA - Wed Feb 11 15:31:03
     [email protected], [email protected]
      (Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
------------------------------
[email protected]
   DD6C66A8064 - Mon Dec  1 17:18:29
     [email protected], [email protected], [email protected]
------------------------------
with --print - postqueue IDs to stdout
7C0C313C0C7
9C2AB13C0BE
DD6C66A8064
AFC351AC602A
E7688DE3FA
with --group rcpt - group output by rcpt
[email protected]
   DD6C66A8064 - Mon Dec  1 17:18:29
     [email protected]
------------------------------
[email protected]
   9C2AB13C0BE - Fri Jan 30 14:52:13
     [email protected]
   DD6C66A8064 - Mon Dec  1 17:18:29
     [email protected]
------------------------------
[email protected]
  AFC351AC602A - Mon Feb 16 07:05:26
     [email protected]
------------------------------
[email protected]
    E7688DE3FA - Wed Feb 11 15:31:03
     [email protected]
------------------------------
[email protected]
   DD6C66A8064 - Mon Dec  1 17:18:29
     [email protected]
------------------------------
[email protected]
    E7688DE3FA - Wed Feb 11 15:31:03
     [email protected]
------------------------------
[email protected]
   7C0C313C0C7 - Mon Jan 26 05:56:53
     MAILER-DAEMON
------------------------------
[email protected]
  AFC351AC602A - Mon Feb 16 07:05:26
     [email protected]
------------------------------

About

Postfix Queue management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages