I've written a milter to replace a hand-coded SMTP relay. This works, but I'm having a problem handling bounces.

The 'relay' actually handles private mailing lists which must be anonymised (for minors). A user sends a mail to 'virtual' addresses, and the relay does a database lookup, and forwards the incoming mail on to the real addresses of the recipients. 'Virtual' in this sense means that all users get a made-up address ('[email protected]'), so the relay just converts between real and made-up private addresses/./

In the Postfix equivalent, the new milter doesn't work without this entry in virtual_alias:

@private.example.comĀ  my-email-address

Where 'my-email-address' is a local address (which isn't required or monitored). So, Postfix first checks the incoming address in virtual_alias; if there is a match, the milter is called. The milter then anonymises and sends on the mail to the real recipient addresses. Note that general name translation is /not/ handled in virtual_alias, because there are hundreds of names, and they're constantly changing, and this is all tied up with a membership database that does lots of other things.

This all works, but there's a problem with bounces. If a bounce is returned with RCPT TO set to <>, postfix/bounce takes over, looks up virtual_alias, and does local delivery to 'my-email-address', /without calling the milter/. This is no good, since I don't want to read all the bounces myself (this was a real problem with the hand-coded relay). /I want the bounce to go back to the original sender/. To do this, postfix/bounce must pass the mail on to the milter instead of handling it itself.

I have thought about deleting the 'bounce' line from master.cf (and 'defer' and 'trace'?). However, I can't do this, because Postfix also handles 'normal' emails to '@example.com' (without the 'private' subdomain). So, ideally, I want to keep postfix/bounce, but make it feed on to the milter. Is this possible? Thanks.

Reply via email to