I've been working on the recoding of the delivery pipeline, and the particular piece of code I'm focusing on right now is in insert_messages() in pipe.c, and is responsible for delivery to forwarding addresses. As I described in an earlier post, the algorithm is that if the message was delivered to any user in the database, then this message will be read out of the database for the forwards. If the message was not delivered to the database, then the message goes directly from the incoming stream to the sendmail processes.
While it seems like a sensible shortcut to skip the database if not needed, the result is that every forwarding address needs to be processes at once. So for 100 forwards, that's 100 instances of sendmail at once! I think that adding db_* functions to work with a temporary table would be a good option to use, but then considered that a simpler option, which would require no additional code, would be adding a dedicated dbmail user account to the database. For example, reserve useridnr 1 or 0 (although I'm not sure that an auto_increment column can even hold the number 0...) With this requirement in place, all incoming mail can be immediately delivered to the database for the dbmail user, further processing can occur (for example, body matching filters) and then the message can be copied to each real user using db_copymsg() and sent to the forwards using the current mechanism. Look ma, no extra tables needed! Transition issues are of course the biggest concern, since before this code could run, somebody's useridnr would have to be renumbered... Thoughts, comment? Aaron
