Simple IMAP for PHP

Manage IMAP mailboxes without the PHP extension.

connect.php
composer.json
use DirectoryTree\ImapEngine\Mailbox;
$mailbox = new Mailbox([
'host' => 'imap.example.com',
'port' => 993,
'encryption' => 'ssl',
'username' => 'user@example.com',
'password' => 'password',
]);
$inbox = $mailbox->inbox();
$messages = $inbox->messages()->get();

ImapEngine

A simple, fluent API for managing IMAP mailboxes in PHP.

Installation

Learn how to install ImapEngine in your PHP project.

Connecting

Learn how to connect to your IMAP server.

Retrieving Messages

Learn how to retrieve and work with email messages.

Real Time Monitoring

Monitor your mailbox in real-time for new messages.


Quick start

Get started with ImapEngine in your PHP project in just a few minutes.

Installing dependencies

Install ImapEngine using Composer:

composer require directorytree/imapengine

Basic usage

Here's a simple example of how to use ImapEngine:

use DirectoryTree\ImapEngine\Mailbox;
$mailbox = new Mailbox([
'host' => 'imap.example.com',
'port' => 993,
'encryption' => 'ssl',
'username' => 'user@example.com',
'password' => 'password'
]);
// Get the inbox folder
$inbox = $mailbox->inbox();
// Get all messages in the inbox
$messages = $inbox->messages()
->withHeaders()
->get();
foreach ($messages as $message) {
echo $message->from()->email();
}

Features

ImapEngine provides a rich set of features for working with IMAP mailboxes:

  • Simple, fluent API
  • No PHP IMAP extension required
  • Support for all major IMAP operations
  • Real-time mailbox monitoring
  • Message creation and manipulation
  • Folder management
  • Attachment handling

Getting Started

Check out our installation guide to get started with ImapEngine in your project.


Getting help

Need help with ImapEngine? Here are some resources:

Documentation

Support