In this release we introduce a new command which exposes the capability of clearing out or removing individual items from the mail queue to the app user. The command is called <code>hypernode-postsuper</code>.

Use case

The common software systems providing email services queue messages as part of their operations. Hypernodes are configured to process a capped amount of emails enforced by the email policies. If the volume of emails to send is higher than the number of emails being processed for delivery, the queue grows larger, and depending on the volume this may consume considerable disk space. Then it may be desired for the app user to clear items from the mail queue of emails that can be sent again later, or simply drop unnecessary email.

Usage

The command can be executed as <code>hypernode-postsuper</code> or /usr/bin/hypernode-postsuper. The help menu displays the available options.


$ hypernode-postsuper --help
usage: hypernode-postsuper [-h] [-v] -d DELETE

Hypernode wrapper for postfix postsuper command

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Enable verbose logging
  -d DELETE, --delete DELETE
                        Delete a message with the named queue ID, or ALL to
                        clear queues, set - to specify queue id from stdin

For example, given we have a few emails in the queue, removing an item from the queue would look like:


app@s2lrmw-farzadghanei-magweb-cmbl:~$ mailq
-Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------
5D769432C0*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

5F30C432C1*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

564BF432BC*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

528A8432BA*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

5BAA4432BF*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

54717432BB*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

59DEB432BE*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

58150432BD*     320 Wed Sep  5 11:45:31  test@example.org
                                         test-recipient@example.org

4FEF9432B7      320 Wed Sep  5 11:45:31  test@example.org
                                                  (mail transport unavailable)
                                         test-recipient@example.org

4E55143188      320 Wed Sep  5 11:45:31  test@example.org
                                                  (mail transport unavailable)
                                         test-recipient@example.org

-- 3 Kbytes in 10 Requests.
app@s2lrmw-farzadghanei-magweb-cmbl:~$ hypernode-postsuper -d 54717432BB
postsuper: 54717432BB: removed
postsuper: Deleted: 1 message
app@s2lrmw-farzadghanei-magweb-cmbl:~$ mailq | grep 54717432BB
app@s2lrmw-farzadghanei-magweb-cmbl:~$

Clearing out the mail queue would look like:

app@s2lrmw-farzadghanei-magweb-cmbl:~$ hypernode-postsuper -d ALL
WARNING: Clearing out postfix mail queues
postsuper: Deleted: 9 messages
app@s2lrmw-farzadghanei-magweb-cmbl:~$ mailq
Mail queue is empty
app@s2lrmw-farzadghanei-magweb-cmbl:~$

This command will become available on all Hypernodes in the coming week.