[PHP] Incoming mail to PHP as Apache module

2001-11-03 Thread Ross

Hi all

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. The script will lookup a database and do
something depending on the mail headers. I'm running on a FreeBSD
virtual server account with sendmail as the mta. I've searched the
archives and read numerous discussions about this but I'm not quite
sure what my best option is.

Most suggestions say to use aliases or Procmail to pipe to PHP running
in cgi mode. I'm trying to avoid that because I have PHP running very
nicely as an Apache module and disk space is at a premium so I don't
want to waste another 4 Mb or so on the cgi executable.

Another idea is to send the mail to a pop mailbox and use PHP to poll
the mailbox every five minutes or so. I can hit a PHP script from cron
using wget.  I'm not really thrilled with the idea of polling and the
delay could put some users off.

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'.

I'd appreciate any suggestions or ideas.

Thanks
Ross


__
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Incoming mail to PHP as Apache module

2001-11-03 Thread Kurt Lieber

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Incoming mail to PHP as Apache module

2001-11-03 Thread DL Neil

 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. The script will lookup a database and do
 something depending on the mail headers. I'm running on a FreeBSD
 virtual server account with sendmail as the mta. I've searched the
 archives and read numerous discussions about this but I'm not quite
 sure what my best option is.
 
 Most suggestions say to use aliases or Procmail to pipe to PHP running
 in cgi mode. I'm trying to avoid that because I have PHP running very
 nicely as an Apache module and disk space is at a premium so I don't
 want to waste another 4 Mb or so on the cgi executable.
... 
 I'd appreciate any suggestions or ideas.


Ross,
Following your comments about HDD space, would the PHP-IMAP functions be any use?
Annotated manual: XXXVII. IMAP, POP3 and NNTP functions
=dn




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]