PHPackages                             everlutionsk/email-bundle-2 - 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. everlutionsk/email-bundle-2

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

everlutionsk/email-bundle-2
===========================

Everlution email bundle for Symfony framework

v2.0.0(3y ago)212.1k↑340%3[2 issues](https://github.com/everlutionsk/email-bundle-2/issues)2MITPHPPHP &gt;=5.4.0

Since Sep 21Pushed 3y ago8 watchersCompare

[ Source](https://github.com/everlutionsk/email-bundle-2)[ Packagist](https://packagist.org/packages/everlutionsk/email-bundle-2)[ RSS](/packages/everlutionsk-email-bundle-2/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (19)Used By (2)

Email Bundle
============

[](#email-bundle)

This Symfony bundle provides mechanism for sending and receiving email messages through various mail systems.

Installation
============

[](#installation)

```
composer require everlutionsk/email-bundle-2
```

### Enable the bundle

[](#enable-the-bundle)

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Everlution\EmailBundle\EverlutionEmailBundle()
    );
}
```

### Configure the bundle

[](#configure-the-bundle)

Following configuration snippet describes how to configure the bundle. Configuration requires a names of services, which implements corresponding interfaces. Only exception is *doman\_name*, where you should set something like *appdomain.com*

```
# app/config/config.yml

# Doctrine Configuration
doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    EverlutionEmailBundle: ~

# EmailBundle Configuration
everlution_email:
    domain_name: APP_DOMAIN
    enforced_delivery_address: EMAIL_ADDRESS|NULL
    mail_system: Implementation of Outbound\MailSystem\MailSystem
    async_stream: Implementation of Support\Stream\Stream
    attachment_swappers:
        inbound: Implementation of Inbound\Attachment\AttachmentSwapper
        outbound: Implementation of Outbound\Attachment\AttachmentSwapper
    request_processors:
        inbound: Implementation of Inbound\RequestProcessor
        outbound_message_event: Implementation of Outbound\MessageEvent\RequestProcessor
```

**mail\_system** - Name of service, which will be used for sending email messages. This service usually comunicate with SMTP server or with some transactional email platform like [Mandrill](https://www.mandrill.com/).

**enforced\_delivery\_address** - \[Optional\] Email address, which will be used to override recipient address in every outbound message.

**async\_stream** - Bundle allows to send email messages asynchronously. Email messages is stored in memory unil some value is added into this Stream. Good example is a Stream of Symfony's [kernel.terminate](http://symfony.com/doc/current/components/http_kernel/introduction.html#the-kernel-terminate-event) events.

**attachment\_swappers** - After sending or receiving a message, bundle try to save the message's attachments by using this *attachment swappers*. This swappers can save attachments in various ways.

**request\_processors** - Bundle provide common mechanism to handle *inbound messages* and *outbound message events*. This events may occur for example when external *mail system* try to send scheduled messages. However, different *mail systems* sending data in different format. Request processors transform this data into format, which is known for this bundle.

### Routing

[](#routing)

Bundle provides controllers for handling *inbound messages* and *outbound message events*.

```
# Handle outbound message events.
everlution.email.outbound_message_event:
    pattern: CUSTOM_PATTERN
    defaults: { _controller: everlution.email.outbound.message_event.controller:handleMessageEvent }
    methods: POST

# Handle inbound messages.
everlution.email.inbound:
    pattern: CUSTOM_PATTERN
    defaults: { _controller: everlution.email.inbound.controller:handleInbound }
    methods: POST
```

Basic Usage
===========

[](#basic-usage)

### Create new outbound message

[](#create-new-outbound-message)

```
$message = new OutboundMessage();
$message->setSubject('Subject');
$message->setText('Message text.');             // Text for basic insight in email client.
$message->setHtml('');      // Email body.
$message->setFromEmail('support@example.com');
$message->setFromName('Sender name');
$message->setReplyTo('reply@example.com');
$message->setRecipients([
    new ToRecipient('recipient@mail.com', 'Recipient name'),
    new CcRecipient('cc-recipient@mail.com', 'Cc recipient name'),
    new BccRecipient('bcc-recipient@mail.com', 'Bcc recipient name'),
]);

$image = new BasicAttachment('image/png', 'logo', file_get_contents('logo.png'));
$attachment = new BasicAttachment('application/pdf', 'document.pdf', file_get_contents('document.pdf'));

$message->setImages([$image]);            // Images included into email body.
$message->setAttachments([$attachment]);
```

### Get mailer

[](#get-mailer)

**Synchronous mailer** - Mail system is called immediately.

```
$mailer = $this->get('everlution.email.outbound.synchronous_mailer');
```

**Asynchronous mailer** - Mail system is called after adding value into corresponding Stream.

```
$mailer = $this->get('everlution.email.outbound.asynchronous_mailer');
```

### Send / Schedule message

[](#send--schedule-message)

```
$mailer->sendMessage($message);
```

```
$mailer->scheduleMessage($message, new \DateTime('+ 30 minutes'));
```

Advanced usage
==============

[](#advanced-usage)

### Message transformers

[](#message-transformers)

Every message could be modified before it is forwarded into *mail system*.

**Transforming outbound messages**
Register service, which implements [OutboundMessageTransformer](Outbound/Message/OutboundMessageTransformer.php) and add following tag:

```
everlution.email.outbound.message_transformer

```

**Transforming inbound messages**
Register service, which implements [InboundMessageTransformer](Inbound/Message/InboundMessageTransformer.php) and add following tag:

```
everlution.email.inbound.message_transformer

```

### Message templates

[](#message-templates)

Some *mail systems* supports message templates, which are defined in this systems. The following code shows how to use this templates.

```
$parameter = new Parameter('PARAMETER_NAME', 'PARAMETER_VALUE');
$template = new Template('TEMPLATE_NAME', [$parameter]);

$message->setTemplate($template);
```

### Handle Inbound messages

[](#handle-inbound-messages)

Inbound messages can be handled by listeners, which listening to `everlution.email.inbound` events. Events are instances of [InboundEvent](Inbound/InboundEvent) and contains information about [Inbound message](Inbound/Message/InboundMessage) and about its [storable version](Entity/StorableInboundMessage), which has been saved into database.

***Caution**: If application doesn't need to create associations with inbound message in database, then storable version of message should be ignored.*

### Mock a mail system

[](#mock-a-mail-system)

Use `everlution.email.mock.mail_system` service as mail system (see *Configure the bundle* section).

Supported mail systems
======================

[](#supported-mail-systems)

[**Mandrill**](https://github.com/everlutionsk/MandrillBundle)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~153 days

Recently: every ~488 days

Total

18

Last Release

1327d ago

Major Versions

v1.4.1 → v2.0.02022-11-15

PHP version history (2 changes)1.0.0PHP &gt;=5.5.0

1.0.1PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c125639a9c5c2bfd86376c10a243fabd78acd9f50826cd6066aac48c194d8b2?d=identicon)[everlution](/maintainers/everlution)

![](https://www.gravatar.com/avatar/b76b6c9b1d27a166b1cc0dae2b5626f94ce192bc3629015f0a3b494d7a57b064?d=identicon)[martinlutter](/maintainers/martinlutter)

---

Top Contributors

[![deftomat](https://avatars.githubusercontent.com/u/5549148?v=4)](https://github.com/deftomat "deftomat (39 commits)")[![ostrolucky](https://avatars.githubusercontent.com/u/496233?v=4)](https://github.com/ostrolucky "ostrolucky (13 commits)")[![martinadamik](https://avatars.githubusercontent.com/u/22906734?v=4)](https://github.com/martinadamik "martinadamik (11 commits)")[![klinec](https://avatars.githubusercontent.com/u/5071231?v=4)](https://github.com/klinec "klinec (8 commits)")[![ttibensky](https://avatars.githubusercontent.com/u/5850762?v=4)](https://github.com/ttibensky "ttibensky (6 commits)")[![ivanbarlog](https://avatars.githubusercontent.com/u/2583610?v=4)](https://github.com/ivanbarlog "ivanbarlog (4 commits)")[![martinlutter](https://avatars.githubusercontent.com/u/19926144?v=4)](https://github.com/martinlutter "martinlutter (2 commits)")[![robisk](https://avatars.githubusercontent.com/u/6409829?v=4)](https://github.com/robisk "robisk (1 commits)")

---

Tags

symfonybundleemaileverlution

### Embed Badge

![Health badge](/badges/everlutionsk-email-bundle-2/health.svg)

```
[![Health](https://phpackages.com/badges/everlutionsk-email-bundle-2/health.svg)](https://phpackages.com/packages/everlutionsk-email-bundle-2)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
