I am developing a web project where I am creating dynamic email accounts and as a email comes to these newly created email accounts, I need to perform some db operations. I am using postfix. But the issue is that how can I set my piping script?

Re: Piping Script with iRedAdmin

Hi Zhang,

So it means for each dynamic email account, I must have to do entry in /etc/postfix/master.cf for that email account ? In my application, there may be thousand of email accounts can be created so is it advisable to do so many entry in master.cf? Please suggest.

Re: Piping Script with iRedAdmin

Hi Zhang,

As I told you already that I am creating multiple dynamic email accounts. So, suppose if I have test1@mydomain.com and test2@mydomain.com then how I will do the entry in master.cf? As per Wikki, I have to do the following:-

sql> USE vmail;sql> UPDATE mailbox SET transport='external-pipe' WHERE username='test1@mydomain.com';

sql> USE vmail;sql> UPDATE mailbox SET transport='external-pipe' WHERE username='test2@mydomain.com';

As defined in master.cf, Postfix will pile email to your script.sh, with option "-f sender@domain.com -d recipient@example.com -m ${extension}". You script should have ability to handle multiple accounts.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

Re: Piping Script with iRedAdmin

Hi Zhang,

Thanks for your response.

But still I am not clear about how I achieved this? As you told that in master.cf, I will set recipient@example.com. But my issue is that I have multiple email accounts like test1@example.com, test2@example.com, test3@example.com etc. and for each email account how I set the "-d ${user}@${domain} " option in master.cf file? My domain name is fixed but the user is not fixed as it is creating dynamically. It may be test1, test2, test3 or something so I will set this in master.cf file and also how my script file will identify that mail is coming on test1@example.com or test2@example.com or test3@example.com etc.?