I have been trying to get this to work for a while now and have been unsuccessful in my attempts. I can do each one individually, but when I try to combine them, it doesn't work as I expected it to. And I imagine it's something I am missing.
I am attempting to receive mail from one or many domains. I am then trying to run a script that [essentially] archives all mail coming through. Lastly, forwarding the messages onto another server. I am able to run a script by using the filter on the smtp, similar to many ways to invoke Spamassassin. The script parses some information out of the mail file, writes (archives) it to a directory. I separately know, by using the relayhost option to forward the mail to a server, I can do this. Call it a relay, gateway, whatever. When I try to combine the procedures, it either forwards all mail before invoking the script, or it just dies(exits successfully) after running the script--depending on the options I do. I have looked into the bcc always option, but it seems to require it to forward to an email address. I am trying to basically "archive" all messages coming through without using the bcc option. We are being required to archive/save all emails (by law requirement) and hang onto them for (x) years. My theory was to put this machine in between incoming mail, capture data, then move it onto the email server. Am I barking up the wrong tree? Am I going about this the wrong way? Any direction would be fantastic, as I am unsure why this current scenario isn't working. Thanks in advance for any helpful information.