[prev in list] [next in list] [prev in thread] [next in thread] 

List:       procmail
Subject:    Re: Email to mySQL
From:       Matt Dunford <matt () stary ! zoomedia ! com>
Date:       2000-10-27 16:46:26
[Download RAW message or body]

All of Philip's comments are correct.  There's also an excellent
article on using php as a general scripting language, which I think
you should check out before you delve any deeper into writing this
program.

http://www.phpbuilder.com/columns/darrell20000319.php3

Happy php'ing.


On Fri, 27 Oct 2000 guenther+procmail@gac.edu wrote:

>
>While Matt has graciously provided one possible approach to the problem
>before S K Rana <rana@akr.com>, I would like to point out two problems
>with it.
>
>Matt Dunford <matt@stary.zoomedia.com> writes:
>...
>>$lines = explode('\n', $header);
>
>That's not right.  rfc822 header fields may extend past a newline if
>the preceeding line starts with a space or tab character.  You should
>either a) do the header extractions in procmail and then have php get
>the values from the environment, b) use a different method of finding the
>desired header fields in php that takes header continuations into account,
>or c) feed the message through "formail -c" before piping it into php.
>Those are in approximate order of CPU efficiency.
>
>
>># iterate through header looking for certain
>>$wanted_headers = array( 'sender', 'date', 'time', 'subject' );
>>while ($line = array_shift($lines))
>>  if (eregi('^$wanted_headers', $line))
>>    $$wanted_headers = eregi_replace('^$wanted_headers: ', '', $line);
>
>You left out the colon in the first regexp, which may cause problems if
>the message contains a Date-Received: field, or something like that.
>Be aware that what is allowed between the field name and the colon,
>and it is not required after the colon.  As a result, I suspect that
>those last two lines would be more correct as:
>
>  if (eregi('^($wanted_headers)[ \t]*:', $line))
>    $$wanted_headers = eregi_replace('^($wanted_headers)[ \t]*: ?', '', $line);
>
>However, that syntax is a guess, as I've never programmed in php before,
>so it may be fundamentally wrong.
>
>
>Philip Guenther
>


_______________________________________________
procmail mailing list
procmail@lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic