Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/receive_many_specific.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ve Bailovity  >  GmAtom  >  examples/receive_many_specific.php  >  Download  
File: examples/receive_many_specific.php
Role: Example script
Content type: text/plain
Description: Receive specific number of new messages from Gmail Inbox
Class: GmAtom
Access Gmail mailboxes retrieving XML Atom feeds
Author: By
Last change: Access without login.
Date: 7 years ago
Size: 836 bytes
 

Contents

Class file image Download
<?php
/**
 * Receive specific number of new messages from Gmail Inbox.
 * 
 * Created on 11-Nov-06.
 * 
 * @package gmTest
 * @author Vladislav Bailovic <malatestapunk@gmail.com>
 */

include ('../gmatom.php');

$g = new GmAtom ('username''password');
$msgCount $g->check();
if (
false === $msgCount) {
    die (
'Error');
} else {
    echo 
"<h1>".$msgCount." messages</h1>";
    
// If you don't need the message body, omit the third parameter:
    
$g->receive(2,5true);
    
$g->sortBy('subject'true);
    echo 
'<dl>';
    foreach (
$g->messages as $mid=>$msg) {
        echo 
'<dt>'.$mid.': <B>'.$msg->from.'</b> '.$msg->subject.'</dt>';
        echo 
'<dd>'.$msg->body.'</dd>';
        echo 
'<dd>'.date('r'$msg->timestamp)." ({$msg->date})".'</dd>';
        echo 
'<dd><a href="'.$msg->link.'">'.$msg->link.'</a></dd>';    
    }
    echo 
'</dl>';
}
?>