PHPackages                             dadadev/imap-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. dadadev/imap-bundle

Abandoned → [secit-pl/imap-bundle](/?search=secit-pl%2Fimap-bundle)Symfony-bundle[Mail &amp; Notifications](/categories/mail)

dadadev/imap-bundle
===================

PHP-IMAP Symfony integration.

1.0.1(4y ago)12.7kMITPHPPHP &gt;=7.4.0

Since Jan 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/DaDeather/symfony-imap-bundle)[ Packagist](https://packagist.org/packages/dadadev/imap-bundle)[ Docs](https://dadadev.com)[ RSS](/packages/dadadev-imap-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

PHP-IMAP integration bundle
===========================

[](#php-imap-integration-bundle)

Simple [php-imap](https://github.com/barbushin/php-imap) integration for Symfony 2.8, 3.x, 4.x, 5.x and 6.x.

Installation
------------

[](#installation)

#### 1. Composer

[](#1-composer)

From the command line run

```
$ composer require dadadev/imap-bundle

```

If you're using Symfony Flex you're done and you can go to the configuration section otherwise you must manually register this bundle.

#### 2. Register bundle

[](#2-register-bundle)

If you're not using Symfony Flex you must manually register this bundle in your AppKernel by adding the bundle declaration

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            ...
            new DaDaDev\ImapBundle\ImapBundle(),
        ];

        ...
    }
}
```

Configuration
-------------

[](#configuration)

Setup your mailbox configuration. If your are using symfony 2.8 or 3.x without Symfony Flex add your configuration in `app/config/config.yml`. If you're using Symfony 4 or Symfony 3.x with Flex open the `config/packages/imap.yaml` and adjust its content.

Here is the example configuration:

```
imap:
    connections:
        example_connection:
            mailbox: "{localhost:993/imap/ssl/novalidate-cert}INBOX"
            username: "email@example.com"
            password: "password"

        another_connection:
            mailbox: "{localhost:143}INBOX"
            username: "username"
            password: "password"
            attachments_dir: "%kernel.root_dir%/../var/imap/attachments"
            server_encoding: "UTF-8"
```

If you're using Symfony to connect to a Microsoft 365 business environment, there's a good chance you'll want to connect to a shared mailbox. In that case you need to specify the parameters `authuser` and `user`. Where *shared\_account* is the username without domain, like:

```
imap:
    connections:
        example_connection:
            mailbox: "{outlook.office365.com:993/imap/ssl/authuser=first.last@example.com/user=shared_account}Root/Folder"
            username: "email@example.com"
            password: "password"
```

Usage
-----

[](#usage)

#### With autowiring

[](#with-autowiring)

In your controller:

```
