Re: Incoming mail to PHP as Apache module
| From: | Kurt Lieber | Date: | Sat, 03 Nov 2001 23:34:02 +0000 |
| Subject: | Re: Incoming mail to PHP as Apache module | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73363@lists.php.net to get a copy of this message | ||
On Saturday 03 November 2001 02:08 pm, Ross wrote:
> Maybe I should be posting this on the Procmail list but someone here
> might have a non-Procmail solution. I'm trying to get a PHP script to
> process incoming email.
I'm sure it can be done with PHP, but my first thought was "why would you
want to?"
Is there a specific reason you want/have to use PHP for this particular
project? PHP is a great web scripting language, but it's not designed as an
incoming mail processing tool, so it likely won't do as good of a job as
procmail or other similar tools that are written expressly for mail
processing.
>It seems that I could do with a way of writing a message to a unique
>file and then calling the PHP script with wget. The script can then>
>read the file. I almost have this working with Procmail by using a
>maildir type mailbox but its back to front, I can only call PHP before
>the message is written to the file because Procmail stops once it is
>'delivered'.
If you're looking for something that can look up data in a database and
manipulate message headers based on the return data, then I'd say Perl is a
better option since it will provide a better blend of powerful text
processing with web and database enablement. Specifically, the Mail::Audit
perl module available (for free) at CPAN.org. It's intended as a procmail
replacement, but with easier syntax and is written in Perl, so you can easily
modifiy it to hook into a database.
(If you're just playing around with PHP, trying to see what you can do with
it, then by all means, give it a whirl and let us all know how it turns out.
If not, then hopefully mail::audit or something similar might help you out.)
--kurt