1|PythonPIP|_ |PythonSupport|_ |License|_ |Codacy|_ |Coverage|_ |RTFD|_ |Travis|_
2
3pymailq - Simple Postfix queue management
4=========================================
5
6| **Contact:** Denis 'jawa' Pompilio <denis.pompilio@gmail.com>
7| **Sources:** https://github.com/outini/pymailq/
8|
9| A full content documentation, is online at https://pymailq.readthedocs.io/en/latest/
10|
11| The pymailq module makes it easy to view and control Postfix mails queue. It
12| provide several classes to store, view and interact with mail queue using
13| Postfix command line tools. This module is provided for automation and
14| monitoring developments.
15|
16| This project also provides a shell-like to interact with Postfix mails queue.
17| It provide simple means to view the queue content, filter mails on criterias
18| like Sender or delivery errors and lead administrative operations.
19
20Installation
21------------
22
23Install pymailq module from https://pypi.python.org::
24
25    pip install pymailq
26
27Install pymailq module from sources::
28
29    python setup.py install
30
31A SPEC file is also provided for RPM builds (currently tested only on Fedora),
32thanks to Nils Ratusznik (https://github.com/ahpnils). Debian binary packages
33are also available.
34
35Requirements
36------------
37
38This module actually support the following Python versions:
39
40*  *Python 2.7*
41*  *Python 3+*
42
43A shell is provided for interactive administration. Based on Python *cmd*
44module, using Python compiled with *readline* support is highly recommended
45to access shell's full features.
46
47Using the shell
48---------------
49
50Mails queue summary::
51
52    ~$ pqshell --summary
53
54    ====================== Mail queue summary ========================
55    Total mails in queue: 1773
56    Total queue size: 40.2 MB
57
58    Mails by accepted date:
59        last 24h:          939
60        1 to 4 days ago:   326
61        older than 4 days: 173
62
63    ----- Mails by status ----------    ----- Mails by size ----------
64    Active      2                       Average size      23.239 KB
65    Hold        896                     Maximum size    1305.029 KB
66    Deferred    875                     Minimum size       0.517 KB
67
68    ----- Unique senders -----------    ----- Unique recipients ------
69    Senders     156                     Recipients          1003
70    Domains     141                     Domains              240
71
72    ----- Top senders ------------------------------------------------
73    228    sender-3@domain-1.tld
74    195    sender-1@domain-4.tld
75    116    MAILER-DAEMON
76    105    sender-2@domain-2.tld
77    61     sender-7@domain-3.tld
78
79    ----- Top sender domains -----------------------------------------
80    228    domain-1.tld
81    195    domain-4.tld
82    105    domain-2.tld
83    75     domain-0.tld
84    61     domain-3.tld
85
86    ----- Top recipients ---------------------------------------------
87    29     user-1@domain-5.tld
88    28     user-5@domain-9.tld
89    23     user-2@domain-8.tld
90    20     user-3@domain-6.tld
91    20     user-4@domain-7.tld
92
93    ----- Top recipient domains --------------------------------------
94    697    domain-7.tld
95    455    domain-5.tld
96    37     domain-6.tld
97    37     domain-9.tld
98    34     domain-8.tld
99
100Using the shell in interactive mode::
101
102    ~$ pqshell
103    Welcome to PyMailq shell.
104    PyMailq (sel:0)> store load
105    500 mails loaded from queue
106    PyMailq (sel:500)> show selected limit 5
107    2017-09-02 17:54:34 B04C91183774 [deferred] sender-6@test-domain.tld (425B)
108    2017-09-02 17:54:34 B21D71183681 [deferred] sender-2@test-domain.tld (435B)
109    2017-09-02 17:54:34 B422D11836AB [deferred] sender-7@test-domain.tld (2416B)
110    2017-09-02 17:54:34 B21631183753 [deferred] sender-6@test-domain.tld (425B)
111    2017-09-02 17:54:34 F2A7E1183789 [deferred] sender-2@test-domain.tld (2416B)
112    ...Preview of first 5 (495 more)...
113    PyMailq (sel:500)> show selected limit 5 long
114    2017-09-02 17:54:34 B04C91183774 [deferred] sender-6@test-domain.tld (425B)
115      Rcpt: user-3@test-domain.tld
116       Err: Test error message
117    2017-09-02 17:54:34 B21D71183681 [deferred] sender-2@test-domain.tld (435B)
118      Rcpt: user-3@test-domain.tld
119       Err: Test error message
120    2017-09-02 17:54:34 B422D11836AB [deferred] sender-7@test-domain.tld (2416B)
121      Rcpt: user-2@test-domain.tld
122       Err: mail transport unavailable
123    2017-09-02 17:54:34 B21631183753 [deferred] sender-6@test-domain.tld (425B)
124      Rcpt: user-3@test-domain.tld
125       Err: mail transport unavailable
126    2017-09-02 17:54:34 F2A7E1183789 [deferred] sender-2@test-domain.tld (2416B)
127      Rcpt: user-1@test-domain.tld
128       Err: mail transport unavailable
129    ...Preview of first 5 (495 more)...
130    PyMailq (sel:500)> select error "Test error message"
131    PyMailq (sel:16)> show selected rankby sender
132    sender                                    count
133    ================================================
134    sender-2@test-domain.tld                  7
135    sender-4@test-domain.tld                  3
136    sender-6@test-domain.tld                  2
137    sender-5@test-domain.tld                  1
138    sender-8@test-domain.tld                  1
139    sender-3@test-domain.tld                  1
140    sender-1@test-domain.tld                  1
141    PyMailq (sel:16)> select sender sender-2@test-domain.tld
142    PyMailq (sel:7)> super hold
143    postsuper: Placed on hold: 7 messages
144    PyMailq (sel:7)> select reset
145    Selector resetted with store content (500 mails)
146    PyMailq (sel:500)> show selected rankby status
147    status                                    count
148    ================================================
149    deferred                                  493
150    hold                                      7
151    PyMailq (sel:500)> exit
152    Exiting shell... Bye.
153
154Packaging
155---------
156
157Binary packages for some linux distribution are available. See the *packaging*
158directory for more information.
159
160License
161-------
162
163"GNU GENERAL PUBLIC LICENSE" (Version 2) *(see LICENSE file)*
164
165
166.. |PythonPIP| image:: https://img.shields.io/pypi/v/pymailq.svg
167.. _PythonPIP: https://pypi.python.org/pypi/pymailq/
168.. |PythonSupport| image:: https://img.shields.io/badge/python-2.7,%203.4,%203.5,%203.6-blue.svg
169.. _PythonSupport: https://github.com/outini/pymailq/
170.. |License| image:: https://img.shields.io/badge/license-GPLv2-blue.svg
171.. _License: https://github.com/outini/pymailq/
172.. |Codacy| image:: https://api.codacy.com/project/badge/Grade/8444a0f124fe463d86a91d80a2a52e7c
173.. _Codacy: https://www.codacy.com/app/outini/pymailq
174.. |Coverage| image:: https://api.codacy.com/project/badge/Coverage/8444a0f124fe463d86a91d80a2a52e7c
175.. _Coverage: https://www.codacy.com/app/outini/pymailq
176.. |RTFD| image:: https://readthedocs.org/projects/pymailq/badge/?version=latest
177.. _RTFD: http://pymailq.readthedocs.io/en/latest/?badge=latest
178.. |Travis| image:: https://travis-ci.org/outini/pymailq.svg?branch=master
179.. _Travis: https://travis-ci.org/outini/pymailq
180
181