PHP Classes

File: examples/basic.php

Recommend this page to a friend!
  Classes of Marcelo Rocha   Email Reader   examples/basic.php   Download  
File: examples/basic.php
Role: Example script
Content type: text/plain
Description: Basic usage
Class: Email Reader
Retrieve email messages from POP3 or IMAP mailbox
Author: By
Last change:
Date: 9 years ago
Size: 494 bytes
 

Contents

Class file image Download
<?php
   
require_once 'vendor/autoload.php';
   
//Gmail
   
$MailBox = EmailMD\MailBoxFactory::gmail(
       
'yourusername@gmail.com',
       
'yourpassword'
   
);

   
$MailBox->reverse();//Newest message first
   
$MailBox->filterSince(new DateTime());//Just message recieved today
    //Get messages
   
foreach ( $MailBox as $messageNumber => $message ) {
        echo
'Message number: ' . $messageNumber . PHP_EOL;
        echo
$message->getSubject() . PHP_EOL;
    }
?>