Re: Running a script for email received

2014-08-12 Thread E.S. Rosenberg
re:all
procmail and/or sieve seem to be the natural candidates
With /etc/alias you could also pipe the mail into a script which would
trigger the script...




2014-08-12 12:45 GMT+03:00 E.S. Rosenberg e...@g.jct.ac.il:

 procmail and/or sieve seem to be the natural candidates
 With /etc/alias you could also pipe the mail into a script which would
 trigger the script...


 2014-08-11 19:38 GMT+03:00 Ori Idan o...@helicontech.co.il:

 I am trying to run a script when an email is received on my server.
 I tried what described here:

 http://blog.thecodingmachine.com/content/triggering-php-script-when-your-postfix-server-receives-mail

 But it invoked the script for all mails not mail to a specific user
 I tried the simplest thing of /etc/alias
 But got error: Recipient address rejected: User unknown in virtual alias
 table

 Does anyone have any idea how to run a script for mail sent to a specific
 user?

 --
 Ori Idan


 ___
 Linux-il mailing list
 Linux-il@cs.huji.ac.il
 http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il



___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Running a script for email received

2014-08-12 Thread Geoff Shang

On Mon, 11 Aug 2014, Ori Idan wrote:


I am trying to run a script when an email is received on my server.
I tried what described here:
http://blog.thecodingmachine.com/content/triggering-php-script-when-your-postfix-server-receives-mail

But it invoked the script for all mails not mail to a specific user
I tried the simplest thing of /etc/alias
But got error: Recipient address rejected: User unknown in virtual alias
table


/etc/aliases is used by the local delivery agent to deliver local mail. 
That is to say, it delivers mail to actual accounts on the same system and 
for addresses with domains listed in $mydestination.  If the mailbox isn't 
for an existing user or the domain is a virtual or relay domain, you will 
need to use virtual_alias_maps.


The above suggests that postfix is looking in virtual_alias_maps for the 
address to which you are sending.  Unfortunately, scripts can't be used as 
targets for virtual_alias_maps lookups.


You could alias a virtual address to a local address which is an alias for 
the desired command.  This is what Mailman does.  For example, if you have 
a mailing list called management for the domain example.com, Mailman's 
virtual_alias_maps table would contain an entry like this:


managem...@example.com  management

And Mailman's alias_maps file would contain:

management: |/var/lib/mailman/mail/mailman post management

Note that there isn't an actual user called management on the system.

This is probably the easiest way to achieve this, there are probably other 
ways like setting up a transport which could be used to call the script as 
described in the post but might not be worth the hassle for just one user.


All this is pretty well described in the various Postfix manpages.  Feel 
free to ask for further clarification, this stuff takes a bit to get one's 
head around.


HTH,
Geoff.


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Running a script for email received

2014-08-11 Thread Ori Idan
I am trying to run a script when an email is received on my server.
I tried what described here:
http://blog.thecodingmachine.com/content/triggering-php-script-when-your-postfix-server-receives-mail

But it invoked the script for all mails not mail to a specific user
I tried the simplest thing of /etc/alias
But got error: Recipient address rejected: User unknown in virtual alias
table

Does anyone have any idea how to run a script for mail sent to a specific
user?

-- 
Ori Idan
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Running a script for email received

2014-08-11 Thread Dolev Farhi
What do you have configured in /etc/postfix/virtual?
--
df
On Mon, Aug 11, 2014 at 7:40 PM, Ori Idan o...@helicontech.co.il wrote:I am trying to run a script when an email is received on my server.I tried what described here:http://blog.thecodingmachine.com/content/triggering-php-script-when-your-postfix-server-receives-mail

But it invoked the script for all mails not mail to a specific userI tried the simplest thing of /etc/aliasBut got error: Recipient address rejected: User unknown in virtual alias table

Does anyone have any idea how to run a script for mail sent to a specific user?-- Ori Idan


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il