Saturday, October 11, 2008

//EXAMPLE.PHP

//EXAMPLE.PHP

/*

*/
include("receivemail.class.php");
// Create Object For reciveMail Class
$obj= new receiveMail('mygmailusername',mygmailaccountpasswd,'mygmailemailaddress','pop.gmail.com','pop3','110');
//Connect to the Mail Box
$obj->connect();
// Get Total Number of Unread Email in mail box
$tot=$obj->getTotalMails(); //Total Mails in Inbox Return integer value
echo "Total Mails:: $tot
";
for($i=1;$i<=$tot;$i++)
{
$head=$obj->getHeaders($i); // Get Header Info Return Array Of Headers **Key Are (subject,to,toOth,toNameOth,from,fromName)
echo "Subjects :: ".$head['subject']."
";
echo "TO :: ".$head['to']."
";
echo "To Other :: ".$head['toOth']."
";
echo "ToName Other :: ".$head['toNameOth']."
";
echo "From :: ".$head['from']."
";
echo "FromName :: ".$head['fromName']."
";
echo "

";
echo "
*******************************************************************************************
";
echo $obj->getBody($i); // Get Body Of Mail number Return String Get Mail id in interger
$str=$obj->GetAttech($i,"./"); // Get attached File from Mail Return name of file in comma separated string args. (mailid, Path to store file)
$ar=explode(",",$str);
foreach($ar as $key=>$value)
echo ($value=="")?"":"Atteched File :: ".$value."
";
echo "
------------------------------------------------------------------------------------------
";
//$obj->deleteMails($i); // Delete Mail from Mail box
}
$obj->close_mailbox(); //Close Mail Box

?>

0 comments: