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

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

azine/email-bundle
==================

Symfony3 Bundle to send html- &amp; txt-emails (notification about events on your web-app or newsletters etc. scheduled/aggregated) to your users.

4.0.1(7y ago)667.8k23[1 PRs](https://github.com/azine/email-bundle/pulls)MITPHPPHP &gt;=5.6.0CI failing

Since Feb 3Pushed 1mo ago4 watchersCompare

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

READMEChangelogDependencies (18)Versions (17)Used By (0)

Azine Email Bundle
==================

[](#azine-email-bundle)

Symfony2 Bundle provides an infrastructure for the following functionalities:

- simplify the rendering and sending of nicely styled html-emails from within your application
- send notifications/update-infos to your recipients, immediately or aggregated and scheduled.
- send newsletters to the recipients which wish to recieve it.
- preview the email-rendering in your browser and sent test mails to you, to view in your favorite email client.
- view sent emails in a web-view in the browser, for the case the email isn't displayed well in the users email-client.
- link campaign tracking with your analytics tool (google analytics or piwik or ...)
- track email opens with your analytics tool (google analytics or piwik or ...)
- works nicely with transactional email services like mailgun.com.

Table of contents
-----------------

[](#table-of-contents)

- [Quick start guide &amp; examples](#quick-start-guide--examples)
- [Requirements](#requirements)
    - [1. Swift-Mailer with working configuration](#1-swift-mailer-with-working-configuration)
    - [2. Doctrine for notification spooling](#2-doctrine-for-notification-spooling)
    - [3. FOSUserBundle](#3-fosuserbundle)
- [Installation](#installation)
- [Configuration options](#configuration-options)
- [Customise the content and subjects of your emails](#customise-the-content-and-subjects-of-your-emails)
- [Customise the layout of your emails](#customise-the-layout-of-your-emails)
    - [Your own implementation of TemplateProviderInterface](#your-own-implementation-of-templateproviderinterface)
    - [Your own Images](#your-own-images)
    - [Your own Twig-Templates](#your-own-twig-templates)
        - [1. the wrapper-templates](#1-the-wrapper-templates)
        - [2. the content item-templates](#2-the-content-item-templates)
- [Make your emails available in the web-view and web-pre-view](#make-your-emails-available-in-the-web-view-and-web-pre-view)
    - [Configuring the web-view and web-pre-view](#configuring-the-web-view-and-web-pre-view)
    - [Implement WebViewServiceInterface](#implement-webviewserviceinterface)
    - [Update your database](#update-your-database)
    - [Define which mails to store for web-view](#define-which-mails-to-store-for-web-view)
    - [Deleting old "SentEmails"](#deleting-old-sentemails)
- [Operations](#operations)
    - [Deleting failed mail-files from spool-folder](#deleting-failed-mail-files-from-spool-folder)
    - [Examples of Cron-Jobs we use in operation.](#examples-of-cron-jobs-we-use-in-operation)
- [TWIG-Filters](#twig-filters)
    - [textWrap](#textwrap)
    - [urlEncodeText](#urlencodetext)
    - [stripAndConvertTags](#stripandconverttags)
    - [addCampaignParamsForTemplate](#addcampaignparamsfortemplate)
- [Use two different mailers for "normal" and for "urgent" emails](#use-two-different-mailers-for-normal-and-for-urgent-emails)
- [Use transactional email services e.g.e mailgun.com](#use-transactional-email-services-ege-mailguncom)
- [GoogleAnalytics &amp; Piwik: Customize the tracking values in email links](#googleanalytics--piwik-customize-the-tracking-values-in-email-links)
- [Email-open-tracking with a tracking image (e.g. with piwik or google-analytics)](#email-open-tracking-with-a-tracking-image-eg-with-piwik-or-google-analytics)
- [Build-Status etc.](#build-status-etc)

Quick start guide &amp; examples
--------------------------------

[](#quick-start-guide--examples)

- [How to configure](QUICK_START.md)
- [Examples on how to use the plugin](USAGE_EXAMPLES.md)

Requirements
------------

[](#requirements)

##### 1. Swift-Mailer with working configuration

[](#1-swift-mailer-with-working-configuration)

Mails are sent using the Swiftmailer with it's configuration.

So the symfony/swiftmailer-bundle must be installed and properly configured.

##### 2. Doctrine for notification spooling

[](#2-doctrine-for-notification-spooling)

For spooling notifications and for the web-view, Notification-/SentEmail-Objects (=&gt;`Azine\EmailBundle\Entity\Notification`/`Azine\EmailBundle\Entity\SentEmail` ) are stored in the database. So far only doctrine-storage is implemented.

##### 3. FOSUserBundle

[](#3-fosuserbundle)

In its current Version it depends on the [FOSUserBundle](https://github.com/FriendsOfSymfony/FOSUserBundle), as it also "beautyfies" the mails sent from the FOSUserBundle and uses the Users to provide recipient information (name/email/notification interval/newsletter subscription) for the mails to be sent.

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

[](#installation)

To install AzineEmailBundle with Composer just add the following to your `composer.json` file:

```
// composer.json
{
    require: {
        "azine/email-bundle": "dev-master"
    }
}
```

Then, you can install the new dependencies by running Composer’s update command from the directory where your `composer.json` file is located:

```
php composer.phar update

```

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle. AzineEmailBundle has a dependency on KnpPaginatorBundle, so it`s also nessesary to add it to AppKernel.php file after installing.

```
