Login   Register  
PHP Classes
elePHPant
Icontem

File: Examples/Example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of t withers  >  Lightning IMAP  >  Examples/Example.php  >  Download  
File: Examples/Example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Lightning IMAP
Access messages in a mailbox via IMAP protocol
Author: By
Last change:
Date: 2012-11-27 22:19
Size: 716 bytes
 

Contents

Class file image Download
<?php
require '../Imap.php';
$imap=new Imap(array(
    
'host'=>'imap.gmail.com',
    
'username'=>'xxx@gmail.com',
    
'password'=>'xxx',
    
'port'=>993,
    
'ssl'=>true,
));
echo 
"<pre>".print_r($imap->info,true)."</pre>";

echo 
"<br/><br/>";

$messages=$imap->sort('FROM','ASC')->get();
echo 
"<pre>".print_r($messages,true)."</pre>";

echo 
"<br/><br/>";

foreach(
$messages as $message){
    echo 
$message->subject.'<br/>';
}

echo 
"<br/><br/>";

foreach(
$messages as $message){
    echo 
$message->messageNumber.' - '.($message->hasAttachments()?'Attachments exist':'No Attachments')."<br/>";
}

echo 
"<br/><br/>";

echo 
$messages[1]->hasPlain()?$messages[1]->plain:$messages[1]->html;