HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   using PHP as a mail filter (http://www.howtoforge.com/forums/showthread.php?t=55253)

dgmufasa 5th December 2011 19:59

using PHP as a mail filter
 
Hello all,

How can one attach .php code to a mail filter? The idea being that when an email arrives, it will "trigger" the php code to work on it.

TIA

falko 6th December 2011 23:19

http://www.postfix.org/FILTER_README.html

You can use a simple shell script and call your PHP script from it as follows:

Code:

/usr/bin/php /path/to/your/script
(This assumes the PHP is located in /usr/bin/php - please adjsut this if necessary.)

dgmufasa 12th December 2011 15:11

One last question ..
 
Quote:

Originally Posted by falko (Post 268993)
http://www.postfix.org/FILTER_README.html

You can use a simple shell script and call your PHP script from it as follows:

Code:

/usr/bin/php /path/to/your/script
(This assumes the PHP is located in /usr/bin/php - please adjsut this if necessary.)

Below is the ISPConfig API call to create a filter for the mailbox. I need to use this in the program being written.

Quote:

try {
if($session_id = $client->login($username,$password)) {
echo 'Logged successfull. Session ID:'.$session_id.'<br />';
}

//* Set the function parameters.
$client_id = 1;
$params = array(
'server_id' => 1,
'type' => 'header',
'pattern' => 'hmmnoe@test.int',
'data' => 'data',
'action' => 'DISCARD',
'active' => 'y'
);

$filter_id = $client->mail_filter_add($session_id, $client_id, $params);
How can I fix this so that it calls the PHP script that you mention?


All times are GMT +2. The time now is 14:38.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.