Hi Nicklas!
On Tue, 09 Jan 2001, Nicklas af Ekenstam wrote:

> I have a server running qmail and php on which I'm trying to do some php 
> processing of incoming e-mail.
> I have a virtual domain set up like this:
> 
> '.qmail-virtualdomain.com-default'
> which contains the following:
> '|/usr/local/php-4.0.1pl2/php /home/nille/script.php -q'
> 
nice :)

> What I would like to know is if there is a nice way of parsing out the body 
> of the incoming message and place that into a variable and also the same 
> thing with the subject so that I can process these using som regular 
> expressions and respond to certain keywords using custom templates.
> 
well, IIRC, the mail is available at the stdin, right? So in your script.php
you may do a fopen ("php://stdin") and read it. You can either save it to a
temporary file (assuming it's a big one) or process it in memory.

Now, I dunno if qmail also sends via environ the mail size, but I guess there
should be a way to figure it out.

Given the mail into a temp. file, you can use all imap_* functions on it, of
particular interest being imap_rfc822*() functions for example.

I once wrote a small and clumsy code for a freemail application (long ago) and
now I was considering something like that for preparsing of the mails at the
incoming time, not reading time as most do, so I'll dig too and if I find
something more interesting I'll let you know :)

cheers,

-- teodor

-- 
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]

Reply via email to