PHPackages                             knyk/mailbox-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. knyk/mailbox-bundle

ActiveSymfony-bundle[Mail &amp; Notifications](/categories/mail)

knyk/mailbox-bundle
===================

PhpImap\\Mailbox Symfony integration.

2.0.0(5y ago)01.8kMITPHPPHP &gt;=7.4CI failing

Since Dec 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/knyk/mailbox-bundle)[ Packagist](https://packagist.org/packages/knyk/mailbox-bundle)[ RSS](/packages/knyk-mailbox-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (5)Used By (0)

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

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

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

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

[](#installation)

#### 1. Composer

[](#1-composer)

From the command line run

```
$ composer require knyk/mailbox-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 Knyk\MailboxBundle\MailboxBundle(),
        ];

        ...
    }
}
```

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

[](#configuration)

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

Here is the example configuration:

```
mailbox:
    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"
```

Usage
-----

[](#usage)

#### Connections

[](#connections)

All connections from your configuration will be accessible by injecting service like that:

```
App\YourService:
  arguments:
    $mailbox: '@knyk.mailbox.connection.example_connection'
```

#### With autowiring

[](#with-autowiring)

In your controller:

```
