Jump to content

Unread Messages Gmail


smarcus3

Recommended Posts

Here is the working code

 


$mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "********@gmail.com","********", OP_READONLY) or die ("can't connect: " . imap_last_error());

$status = imap_status($mbox, "{imap.gmail.com}INBOX", SA_ALL);

if ($status) {
  echo "Messages:  " . $status->messages    . "<br />\n";
  echo "Recent:    " . $status->recent      . "<br />\n";
  echo "Unseen:    " . $status->unseen      . "<br />\n";
  echo "UIDnext:    " . $status->uidnext    . "<br />\n";
  echo "UIDvalidity:" . $status->uidvalidity . "<br />\n";
} else {
  echo "imap_status failed: " . imap_last_error() . "\n";
}
[/Code]

Also if someone wants to see the output please use this link. http://smarcus3.x10.mx/

 

Here is the complete index.php code

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<meta name="description" content="" />

<meta name="keywords" content="" />

<meta name="author" content="" />

<link rel="stylesheet" type="text/css" href="style.css" media="screen" />

<title></title>

</head>

<body>

<?php

$mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "[email protected]","xxx", OP_READONLY) or die ("can't connect: " . imap_last_error());

$status = imap_status($mbox, "{imap.gmail.com}INBOX", SA_ALL);

if ($status) {
  echo "Messages:  " . $status->messages    . "<br />\n";
  echo "Recent:    " . $status->recent      . "<br />\n";
  echo "Unseen:    " . $status->unseen      . "<br />\n";
  echo "UIDnext:    " . $status->uidnext    . "<br />\n";
  echo "UIDvalidity:" . $status->uidvalidity . "<br />\n";
} else {
  echo "imap_status failed: " . imap_last_error() . "\n";
}


?>

</body>

</html>
[/Code]

 

EDIT (KP) Removed credz

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.