Question

I am using postfix in my production server which will receive all the emails related to mydomain.com In this context, I want to forward only emails related to few users to different email addresses. By which I mean, lets say I am a super user(superuser@mydomain.com). I want to forward all my emails(all mails with to:superuser@mydomain.com) to my personal email id: superuser@gmail.com. So I think I would some programming logic is needed here. So I want to write a custom python script which should read the postfix email inbox and forward all new emails depending on the said criteria. Can I do this? I heard about .forward file in the postfix arena. Can I use that to achieve the same(by totally bypassing pythonic solution)?

Was it helpful?

Solution

Procmail is the solution for mail filtering. You can call python scripts from your .procmailrc if you need more scripting.

OTHER TIPS

It sounds like you just need to set up aliases, not script anything.

On most Unix/Linux systems, you simply add aliases to your /etc/aliases file:

superuser:                 marc,webmaster@my-site.com

then run:

newaliases

Then mail sent to "superuser" would go to "marc" and "webmaster@my-site.com" instead.

here's a tutorial, and here's the postfix 'aliases' man page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top