Quote:
|
Originally Posted by MikeSD
I want an email filter that ...
Basically this will do nothing to the email itself but will execute a PHP script to do some email scanning for certain content that I send in my email and save it to an external file.
Is that possible? What is the best method? Would that be a "Simple filter" or a "processor filter"? Anyone have a basic shell for this? I prefer to use PHP.
|
You want to run a Simple Filter. A "processor" is used to modify the email, which you say you do not want to do.
Quote:
|
Originally Posted by MikeSD
1) Runs all emails from a specific address only, through a filter.
|
You can't run the filter based on the from email address. A filter is set up on one of your POP are Alias email addies, and EVERY email delivered TO that address will trigger the filter.
You will need to have the filter script detect the FROM address and only take the desired actions if the approprate FROM address is in the email.
Quote:
|
Originally Posted by MikeSD
2) Based on email contents, it will execute a PHP script.
|
You want the filter to call another PHP script? I would suggest incorporating them into a single script.
Quote:
|
Originally Posted by MikeSD
3) The PHP script will not modify the original email.
|
If I understand your request correctly, all you want to do is write the text of the email to a file if it comes from a certain FROM address?
Quote:
|
Originally Posted by MikeSD
3) Return with status to process the mail normally.
|
Unless an error condition is encountered when the script runs, or your script sets a particular action on exit, the default is for the mail system to process the mail normally when the script finishes execution.
Basically, here is what the script would need to do...
An email filter is provided the raw message text as standard input. Read standard input into some variable at the beginning of your script.
Parse the message somehow to find the From email address.
If it matches your target address, then open the file you want to write to (in append mode).
Write out the pertinent content from the email message in your stored variable to the file.
Close the file.
End of script.