PHPackages                             hautzi/system-mail-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. hautzi/system-mail-bundle

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

hautzi/system-mail-bundle
=========================

This Bundle provides a nice abstraction for sending system emails

0.9.0(6y ago)181.8k3[1 issues](https://github.com/christoph-hautzinger/SystemMailBundle/issues)MITPHPPHP &gt;=7.0

Since May 9Pushed 6y agoCompare

[ Source](https://github.com/christoph-hautzinger/SystemMailBundle)[ Packagist](https://packagist.org/packages/hautzi/system-mail-bundle)[ Docs](https://github.com/christoph-hautzinger/SystemMailBundle)[ RSS](/packages/hautzi-system-mail-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (10)Used By (0)

HautziSystemMailBundle
======================

[](#hautzisystemmailbundle)

[![SensioLabsInsight](https://camo.githubusercontent.com/697a2ad3ebfcc400f23b58a99134ec4ee2479c9693cd561f39e3e09f7d89d30c/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f37633364316630362d643032652d343463662d616332342d3363616430346163386562662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/7c3d1f06-d02e-44cf-ac24-3cad04ac8ebf)[![Build Status](https://camo.githubusercontent.com/06037ff8f229f3e13e94d7048d3e35f01d97def9ea75ee38f7b9cfd28368a5ee/68747470733a2f2f7472617669732d63692e6f72672f6368726973746f70682d686175747a696e6765722f53797374656d4d61696c42756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/christoph-hautzinger/SystemMailBundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b4b4ebf44590982233987be51b7786de049f8da0502b7aa8f9a236506083f49d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6368726973746f70682d686175747a696e6765722f53797374656d4d61696c42756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/christoph-hautzinger/SystemMailBundle/?branch=master)

This bundle abstracts away sending system Messages. If instanciating a `Swift_Message` instance in your controllers seems fishy to you, this is probably what you are looking for.

This idea of this Bundle is to create some sort of XML configuration for each system mail to be sent (like "you have registered successfully, please activate your account" or "hey dude, you haven't been wasted your money on our platform for 10 days, please come back"), leveraging the power of twig.

Hey, why not looking in the code? It's kind of self-explanatory:

```
// AppBundle/Resources/emails/send-info.xml.twig

    {{ user.email }}
    Hallo {{ user.name }}
    Hello {{ user.name }}
    [CDATA[
        Hallo {{ user.name }},
        please click this link.
    ]]>

        Hello {{ user.name }},
        please click this link: {{ url('') }}

```

Then send out this mail explicitly by simply calling:

```
// from your code simply call
$container->get('system_mailer')->send('emails/send-info.xml.twig', [
    'user' => $user,
]);
```

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

[](#installation)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require hautzi/system-mail-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding the following line in the `app/AppKernel.php`file of your project:

```
