What?
PostInject is a program to allow a collection of postfix queue files to be sent as email messages. The queue files are "working copies" of emails that postfix stores in /var/spool/postfix
. There is probably a built-in postfix way to do it, but I couldn't find it when I needed to.
Download the program, but it would pay to read the instructions below first.
Note that a better way of doing this kind of thing is documented here. I'll keep this program around in case it's needed in some bizarre set of circumstances.
Why?
A postfix upgrade went awry, and I found that it had been about 12 hours with email not going anywhere (both incoming and outgoing). Fortunately, postfix was being as smart as it could, and dumped all the messages in /var/spool/postfix/corrupt
.
In the logs, I was seeing a lot of things like:
Sep 4 12:50:12 kallisti postfix/qmgr[2201]: warning: bad extra offset file active/4/432E08763E
Sep 4 12:50:12 kallisti postfix/qmgr[2201]: warning: 432E08763E: envelope records out of order
Sep 4 12:50:12 kallisti postfix/qmgr[2201]: warning: saving corrupt file "432E08763E" from queue "active" to queue "corrupt"
How?
Run this program, and give it the names of all the queue files that you have lying around not getting sent where they should be. You can also give it options if you like:
- -h
- help
- -s
- the server to send to, defaults to 127.0.0.1
- -d
- the delay (in seconds) between sending groups of messages (default 60)
- -g
- the number of messages to send in a group (default 5)
- -f
- fix missing hostnames on addresses (specify hostname after the -f)
You'll want to tweak the options to suit. If you have all the users running spamassassin, and the server isn't the speediest thing around, consider increasing the delay up to 120 seconds, just to stop the queue getting large and risking timeout bounces. However, if sending mail is nice and fast on your system, you can probably get away with a delay of 10 seconds or so. The default is fairly conservative, but did cause the queue to grow slowly larger with spamassassin running over most of the messages on my system.
When?
- Version 0.1 (Sept 4 2004)
- basic version working
- Version 0.2 (Nov 4 2004)
- added 'recipient:' checking, a bit more verification code included (thanks Alexander <a.an at zebratelecom.ru>)
- Version 0.3 (Nov 5 2004)
- added the -f option
Who?
This was written by Robin Sheat <robin@kallisti.net.nz> as a result of need. Hopefully it isn't something I'll need again, but it's possible others may want it. Patches will be considered, bugs may be fixed, features may even be added: just email me.