I suggest to save the sent mail only in the Mail database and put a sorta of mail send request in another DB ( I.E. mailreq.box ) .
This DB will be processed from a task (i.e. mailreq, not the router) who copy it in the mail.box is some condition are respected.
The mailreq can check somet thing before pick the mail from the DB and put it in the mail.box, this will allow some other very requested feature:
1) set a max mail size policy per DB
2) allow user to select alternative sender address, the mailreq will check if the address are valid.
3) add an outbox folder so user can see if the server have accepted his mail.
4) allow an user/db to send only to certain address.
5) do not send the full message if the message are rejected but only a reply with an error message.
6) retarded delivey , the request have to be processed only after a certain date/time
7) policy routing if a message have certain caracteristic will be postponed o blocked or routed through another server
i.e. if #recpient * Size > 50MB the message will pass in low prioroty if > 500MB will be rejected.
8) archive sent mail, run agent before a mail was sent ......
<other ideas here>
P.S. 1 : i have suggested a specific task mailreq so the routing process will not be affected from possible trouble like attempt to open damaged database or other thing
P.S. 2: a similiar thing can be done with the SMTP task who can receive the mail put them in a smtp.box and put a mailreq in the mailreq.box so mailreq can do other thing
9) Virus check , antispam