Checking Email with PHP


Hi all. I am trying to get a script to check email and display the message. So far, it checks the mail server and returns the number of messages but I can only get it to print the “header” line of the email and not the whole message. Here is what I have so far:

$fp = fsockopen(“”,110);
$getit = fgets($fp,1024);
fputs($fp,“USER myusernamen”);
$getit = fgets($fp,1024);
fputs($fp,“PASS mypasswordn”);
$getit = fgets($fp,1024);
fputs($fp,“STAT n”);
$getit = fgets($fp,1024);
printf (“Mail: $getitnrr”);

Any suggestions on how we can get the message to display?

Thanks in advance.


I’m just shooting in the dark but can’t you use something like file_get_contents()?