I've been browsing the qmailadmin/vpopmail code and see that there's no effort to enforce order in dot-qmail files. Adding lines to a dot-qmail file is just an append to the end of the file it seems with valias_insert and so on [at least in vpalias it is for the files/cdb backend].
I'm looking to add some additional features that depend on order. The main one is a script I've written that checks for existing Spam headers, and should they not exist, checks the mail through SpamAssassin's spamc and exits 99 to stop processing the dot-qmail file or exits cleanly.
The reasoning for this is that I want Maildir delivery's first, delivering properly to the user in question. I then want to run my |ifnotspam command. If it exits 99 (yes it's definately Spam), I don't want to forward the mail, and don't want to autorespond to it. Yes I realize this isn't perfect and may have the occasional bit of real mail not
forwarded. Even more important is the autoresponding, as I find users who set vacation messages can often have hundreds of e-mails per day, many of which are Spam.
Some users have spam scanning with Simscan, but others don't and don't want it. At the same time, I don't want to forward or autorespond (with the mail attached) to mail that if SA thinks will be Spam, so will other major providers.
Now the reasoning isn't too bad, but it depends on the following:
1. vpopmail sorting .qmail and .qmail-* files after it writes them
vpopmail inserting lines in the right place as opposed to appending
2. qmailadmin having a 'add before remote' option that will, if autorespond/forward is set, add a customized line to the dot-qmail file in the right place [using the abilities above] of properly ordering dot-qmail files.
Obviously both would need to take into account extra
things like keeping maildrop and any custom commands above the |ifnotspam command.
Now the second part I don't see as too difficult, as it could check using the valias_* functions to see if the command already exists, and if not add it [as well as remove it in the case of removing a forward/autoresponder, just to clean up]. This would just be adding an extra valias_insert call with a fixed define.
It's the ability to add in a proper order that I'm curious about. Anyone already tried it? Should I give the code a good hacking? See anything else I could affect in doing this?
I think it's a really valuable feature, and should be easy enough to implement.
As a side note, in qmailadmin's autorespond.c, shouldn't these be in the opposite order to prevent any temporary failures after closing the .qmail file without the message file existing yet?
* Make the autoresponder .qmail
* Make the autoresponder message file
- [vchkpw] dot-qmail ordering Michael Krieger
- [vchkpw] vqadmin Andrew Simon
- Re: [vchkpw] dot-qmail ordering John Simpson
- Re: [vchkpw] dot-qmail ordering Tom Collins