Skip to content

EJTH/php-mailbox-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php-mailbox-reader

Easy to use OOP implementation of the PHP IMAP extension

Usage

Here is a simple example of usage. This will effectively show the newest unread mail complete with markup and embedded images:

<?php
//Include mailboxreader class
include 'mailboxreader.class.php';

//Create a new instance of mailboxreader, login to the IMAP/POP3 server
$mailbox = new MailboxReader('{imap.example.com:143/novalidate-cert}INBOX', '[email protected]', 'examplepwd');

//Return a list of UNSEEN message IDs
$newMails = $mailbox->search('UNSEEN');
$unseenCount = count($newMails);
if($unseenCount > 0){
    //Fetch mail, second parameter determines if attachments should be downloaded at this point.
    $message = $mailbox->fetchMail($newMails[$unseenCount-1], true);
    
    //Echo out the HTML contents of the message.
    echo '<h1>'.$message->subject.'</h1>';
    echo $message->html;
}

About

Easy to use OOP implementation of the PHP IMAP extension

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages