« My own private Los Angeles | Main | Using Outlook to import emails to Exchange is painfully slow »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83454428269e200e55189d7058833

Listed below are links to weblogs that reference How to use IMAP as a Gmail API in PHP:

Comments

jeremy

hey thanks for this: btw, on macosx you can use MAMP to do localhost dev and testing - it's built with the imap lib out of the box.. and free! much nicer than the whole yak shaving rigmarole of appleapache..

Pete Warden

Thanks Jeremy, that is a good suggestion, I've been meaning to check out MAMP. At the moment I've fallen back to remote development, but it's definitely slower.

StalkR

Good stuff!

I was looking for an API to connect to Gmail for monitoring purposes (count emails) and indeed IMAP does the trick simply and efficiently.

So I used imap_status() to retrieve the total message count, as well as the unread (unseen) one. Code is merely:

foreach ($folders as $box) {
$status = imap_status($connection, $box, SA_ALL);
echo substr($box,strlen($imapaddress))." ( ".$status->unseen." unread, ".$status->messages." total)";
}

Thanks for the tip!

The comments to this entry are closed.