Skip to content
/ php-imap Public
forked from barbushin/php-imap

Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)

License

Notifications You must be signed in to change notification settings

nand2/php-imap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImapMailbox is PHP class to access mailbox by POP3/IMAP/NNTP using IMAP extension

Features

  • Connect to mailbox by POP3/IMAP/NNTP (see imap_open)
  • Get mailbox status (see imap_check)
  • Receive emails (+attachments, +html body images)
  • Search emails by custom criteria (see imap_search)
  • Change email status (see imap_setflag_full)
  • Delete email

Installation by Composer

{
	"require": {
		"php-imap/php-imap": "~2.0"
	}
}

Or

$ composer require php-imap/php-imap ~2.0

Migration from v1.* to v2.*

Just add following code in the head of your script:

use PhpImap\Mailbox as ImapMailbox;
use PhpImap\IncomingMail;
use PhpImap\IncomingMailAttachment;
$mailbox = new PhpImap\Mailbox('{imap.gmail.com:993/imap/ssl}INBOX', '[email protected]', '*********', __DIR__);
$mails = array();

$mailsIds = $mailbox->searchMailBox('ALL');
if(!$mailsIds) {
	die('Mailbox is empty');
}

$mailId = reset($mailsIds);
$mail = $mailbox->getMail($mailId);

var_dump($mail);
var_dump($mail->getAttachments());

Recommended

About

Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%