Please help me to resolve this problem. I want to store Postfix sent details into My Sql DB. Already create the table and everything but somehow unable to create the relationship between postfix and My Sql. So each time a user sent a mail his data such as user Id , send mail, destination mail, IP etc. get stored into My Sql .
You can make it with content filter. Simply each mail will be delivered via stdin to the script, which will extract headers and save into db. Not sure if you would also check the From and To to make sure you process only outbound mail as you say.
You need to find out what suits you best. You will need to fiddle with main.cf and master.cf, create script like in Perl, PHP, Python and there you go, it's not that hard. The email header finishing after double enter like \r\n\r\n or \n\n
This really depends on your existing configuration as well, like spam and virus checking, if you got this, you could hook this up in the chain (after virus and spam check, for example).