PHP: Documentation. I'm learning how
PHP: Documentation. I'm learning how to parse an email, grab the email address in the From line and then look it up in a MySQL database. To do that, I've printed the source and now I need to learn PHP finally. Usually, Iearn just by reading code, but this is a little harder, so it's off to teh PHP tutorial section.
PHP: Regular Expression Syntax. The tricky part is going to be to do the regular expression search. This is very powerful in PHP with the Preg_match(pattern, string, matches) command that let's you do a regular expression match. In Unix, I would write it as looking for all the legal characters before an "@" sign which is the user name and all the characters after which is the domain name. So if the string says, "From: Richard Tong
The trick tonight is to figure out a regex that would match it and give me "richtong" and "hotmail.com" out of it. Then, I can suck out this and do the Mysql query on the b2 stored email name. Alternatively, I could write a low level thing that searches forward to the "@" sign in something that has From: at the start to find either white space or something that is either an < or a [ and then backwards to the same. I'm going to have to look up valid email identifiers to figure this out. Or look in the POP3 parser class. I have to look at the RFC 1939 POP3 Protocol document to see how the message format works. This is actually RFC 822 Text Message Formats