> Instead of going straight from reciept to the delivery queue, it would go
I'm not sure I understand this sentence. Mail goes from the delivery queue
to the recipient, not around the other way...
> into a processing queue, and hopefully in a manner similar to
> qmail-remote/qmail-local rules, a qmail-process queue would then kick off a
> various processing filters based on a number of rules. The messages may or
> may not be returned to qmail for delivery after processing.
>
> Do you think its possible to insert such logic without changing the whole
> flow of qmail?
>
> Its important that I maintain the original envelope, which to my knowledge
> will be lost if I try to use .qmail sorts of mail processing functionality.
Nope. No envelope info is lost by .qmail processing. Quite the opposite. .qmail
processing especially makes envelope information easily available to a program.
> performance is relevant, so circumventing local delivery would probably be a
> good thing as well.
I would measure the cost before assuming the circumventing local delivery is
going to give you a big performance win.
> Thoughts? Derision? Encouragement?
I'd be very surprised if you couldn't achieve your results without resorting
to the internals of qmail. Probably the externals - all of which are documented
- will be all you need.
You would need to explain what sort of rules you want to have and what they
do to the email? What do the rules apply to? All mail sent thru the system? Only
remote mail? Only local mail? How is that mail first injected? Solely by processes
on that system or across the network via, eg, SMTP?
It sure is trivial to set up a qmail that accepts all mail from local and remote
connections and feeds it thru a default .qmail which can do anything you want
based on your filtering code. Especially note how easy it is to have a program
that drops or forwards a mail with the exit codes documented in the qmail-command
man page.
Here's one possible scenario.
On your filter system you install two instances of qmail. The first handles
the filtering and accepts mail from where you choose. It has a catch-all
virtualdomain entry, something like:
echo :alias-catchall >/var/qmail/control/virtualdomains
In ~alias/.qmail-catchall-default you have something like:
| yourfilteringprograms
| /var/qmail2/bin/forward "$EXT..."
Where:
yourfilteringprograms
Makes judicious use of exit(0), exit(99) and exit(1);
Note that the forwarding uses a second instance of qmail which does not
have a catchall alias.
Remember that qmail reliably places the mail in a queue for processing, if
you don't need that reliability, writing your own thing may well be a win.
If you do need that reliability, you may find that avoiding the qmail queue
and thus inventing your own is a lot more trouble than it's worth.
Regards.