Re: Taking body of an email and storing it in MySQL database

From: Date: Mon, 07 Sep 2009 18:27:05 +0000
Subject: Re: Taking body of an email and storing it in MySQL database
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-297765@lists.php.net to get a copy of this message
Paul, Is there a decent tutorial anywhere on the net for the pop3.class.inc available on phpclasses.org? http://www.phpclasses.org/browse/package/1120.html Maybe I'm blind, but I just can't find anywhere a decent description or tutorial of what calls you can make to its functions. The documentation file has two sections in German and a terse section in English. I'm trying to figure out how to get each message and get their subject line, from address, and then based on those two pieces of information, I'll take the whole body and store them in the right place in a MySQL database. Just for reference, this is what I've built so far (I renamed pop3.class.inc to POP3.php): include('POP3.php'); $pop3 = new POP3(); // Connect to mail server $do = $pop3->connect ('xxx.xxxxxxxxx.com'); if ($do == false) { $message = $pop3->error; } $do = $pop3->login ('uuuuuuuuuuu', 'ppppppppppp'); if ($do == false) { $message = $pop3->error; } $status = $pop3->get_office_status(); if ($status == false) { die($pop3->error); } $count = $status['count_mails']; for ($i = 1; $i <= $count; $i++) { // Here's where I hit a wall. // 1. Get the from address // 2. Get the subject line // 3. Get the header+body as one text file // 4. Store it in the database. } $pop3->close();

« previous php.general (#297765) next »