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

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

adesigns/email-template-bundle
==============================

This bundle helps you to deal with emails in your Symfony2 app. Render emails from Twig or Database, it's easy!.

v1.0.2(6y ago)02.2k1MITPHP

Since Oct 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/adesigns/EmailTemplateBundle)[ Packagist](https://packagist.org/packages/adesigns/email-template-bundle)[ Docs](http://github.com/adesigns/EmailTemplateBundle)[ RSS](/packages/adesigns-email-template-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (7)Used By (0)

Email Templates Bundle for Symfony2
===================================

[](#email-templates-bundle-for-symfony2)

This bundle can be useful when you need to send diffrent kind of emails from your app, for eg. user registration or forgot password email. Read usage section.

[![Build Status](https://camo.githubusercontent.com/5a8f590a9095a70cff26a2a5ce0b6e325ccc721e0591cea962ef2b6225d7268c/68747470733a2f2f7472617669732d63692e6f72672f6d61746865777065746572736f6e2f456d61696c54656d706c61746542756e646c652e737667)](https://travis-ci.org/mathewpeterson/EmailTemplateBundle)

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

[](#installation)

### Add bundle via composer (Symfony 2.1)

[](#add-bundle-via-composer-symfony-21)

```
php composer.phar require sfk/email-template-bundle:dev-master
```

### Add bundle to your application kernel

[](#add-bundle-to-your-application-kernel)

```
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Sfk\EmailTemplateBundle\SfkEmailTemplateBundle(),
    );
}
```

Usage
-----

[](#usage)

- Create registration email template in your bundle

```
src/Acme/DemoBundle/Resources/views/[Emails]/user_registered.html.twig

```

- Edit template

```
// src/Acme/DemoBundle/Resources/views/[Emails]/user_registered.html.twig
{% extends 'SfkEmailTemplateBundle::email.html.twig' %}

{% block from -%}
example@example.org
{%- endblock %}

{% block subject -%}
Thanks for registering {{ first_name }}!
{%- endblock %}

{% block body -%}
Hello {{ first_name }},

Thank you for registering at our website! below your account details:

First Name: {{ first_name }}
Last Name: {{ last_name }}
Email: {{ email }}

Thanks
{%- endblock %}
```

- Now you can send it from your controller

```
