well i don't want any database code plus that uses the IMAP extention. just looking for more simple code that does nothing but checks the POP3 account...nothing extra.
Main Topics
Browse All TopicsHello. I'm looking for a script or class that i can use to check a pop3 account and parse the message body to extract url's etc etc. does anyone have any code or know of a class THAT WORKS : ) ?
preferrably something they've used before that is a known solution. i plan to have the script run as a cron job and parse the body and run some regular expressions then enter the data into a mysql database.
thank you!!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You might want to try this class autoresponse.class.php, I found it at http://www.phpclasses.org/
well i had looked at this one:
http://www.phpclasses.org/
but it doesn't seem to work with any html emails or at least i've not gotten it to return any emails with html.
Here's a sample of what I used in the responseContentSource
$respond->responseContentS
$respond->send('custom','h
It does appear to for me. Just make sure that you use the second line as well.
linuxrox, yes it does. This is a sample file that can be used to reply to pop3 messages. If all you want to do is check a pop3 connection then this may not be the script your are looking for
include("autoresponse.clas
$respond=new autoresponse('your email address','the password for said email address','the from name','pop server');
$respond->connect();
$respond->responseContentS
$respond->send('custom','h
$respond->close_mailbox();
Include all this code in some file and stick it in the same directory as autoresponse.class.php, run the file and it should check a pop3 account and reply with the message in responseContentSource.
Hope this helps.
http://pear.php.net/manual
if it's a mime email, you can decode it with http://pear.php.net/packag
netmunky:
some of the emails will be multi-part probably, html and text emails. some maybe just html, some maybe just text. i'm only concerned about the text emails. not sure if this would be classified as MIME but it sounds like it is. my only other option is to write a windows program to check the emails and deal with them that way which i'd rather not do.
http://www.melonfire.com/c
i used this example:
<?php
// include class
include("Net/POP3.php");
// initialize object
$pop3 = new Net_POP3();
// attempt connection to server
if (!$pop3->connect("example.
die("Error in connection");
}
// attempt login
$ret = $pop3->login("john", "doe");
if (is_a($ret, 'PEAR_Error')) {
die("Error in authentication: " . $ret->getMessage());
}
// print number of messages found
echo $pop3->numMsg() . " message(s) in mailbox\n";
// print message headers
if ($pop3->numMsg() > 0) {
for ($x=1; $x<=$pop3->numMsg(); $x++) {
$hdrs = $pop3->getParsedHeaders($x
echo $hdrs['From'] . "\n" . $hdrs['Subject'] . "\n\n";
}
}
// disconnect from server
$pop3->disconnect();
?>
and i keep getting authentication failures but the username and password i set are indeed correct..strange.
what pop3 daemon are you using?
Net_POP3 is expecting 1 of 3 responses: "+OK", "-ERR", or "+ " (with a space)
apparently it is getting "+" without the space
i'm not intimately familiar with the pop3 RFC, so i don't know if this is a non-compliant server, or if Net_POP3 just needs a little tweaking.
to work around this, locate the Net/POP3.php file (located in the PEAR include directory), find the bit that looks like this:
function _checkResponse($response)
{
if (@substr(strtoupper($respo
return true;
}else{
if (@substr(strtoupper($respo
return $this->_raiseError($respon
}else{
if (@substr(strtoupper($respo
return true;
}
}
}
return $this->_raiseError("Unknow
}
and change it to:
function _checkResponse($response)
{
if (@substr(strtoupper($respo
return true;
} elseif (@substr(strtoupper($respo
return $this->_raiseError($respon
} elseif (@substr(strtoupper($respo
return true;
} elseif (@strlen($response) == 1 && $response == '+' ) {
return true;
}
return $this->_raiseError("Unknow
}
you could do a bug report at http://pear.php.net/bugs/s
assuming you're already logged in, a modified of the above linked sample:
if ($pop3->numMsg() > 0) {
for ($x=1; $x<=$pop3->numMsg(); $x++) {
$hdrs = $pop3->getParsedHeaders($x
$body = $pop3->getBody($x);
$pop3->deleteMsg($x);
echo $hdrs['From'] . "\n" . $hdrs['Subject'] . "\n\n" . $body ."\n\n-------------------\
}
}
$pop3->disconnect(); # if you don't call this, the messages aren't deleted
Business Accounts
Answer for Membership
by: hernst42Posted on 2007-04-24 at 12:07:04ID: 18968535
Never used, but looks like that what you want http://phpclasses.scriptin dex.de/bro wse/packag e/3324.htm l