HomePHP Page 4 - Building A PHP-Based Mail Client (part 1)
Fully Function-al - PHP
Ever wondered how Web-based mail clients work, or what happens toyour email after you hit the "Send" button? This three-part case studydelves into the wild and wacky world of Web-based email applications, usingPHP's built-in POP3 functions to build an email client suitable forrerieving POP3 email via a Web browser. In this introductory segment -connecting to a POP3 server, logging in and out, retrieving message headersfor display, and deleting messages off the server.
Before moving on, a quick word about the "functions.php" file include()d in the script you just saw.
"functions.php" is a separate file containing useful function definitions. Every time I write a function that might come in useful elsewhere in the application, I move it into "functions.php" and include that file in my script.
An example of this is the validate_email() function used in the script above - here's what it looks like:
Again, this is fairly simple - I'm using PHP's pattern
matching capabilities to verify that the email address supplied conforms to the specified pattern. The function returns true or false depending on whether or not the match was successful.