Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/donkeycode/mail-bundle
https://github.com/donkeycode/mail-bundle
bundle symfony symfony-bundle symfony2 symfony3 twig
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/donkeycode/mail-bundle
- Owner: donkeycode
- Created: 2016-11-16T22:26:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-19T17:02:59.000Z (6 months ago)
- Last Synced: 2024-09-30T16:01:38.445Z (4 months ago)
- Topics: bundle, symfony, symfony-bundle, symfony2, symfony3, twig
- Language: PHP
- Size: 24.4 KB
- Stars: 3
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MailBundle
An easy way to send mail with twig and swift
## Setup
````
composer require donkeycode/mail-bundle
````Add in `AppKernel.php`
````
new DonkeyCode\MailBundle\DonkeyCodeMailBundle(),
````## Configuration
````
donkey_code_mail:
mail_from: null
reply_to: null
options:
header_bg: '#2d7cff'
header_txt_color: '#ffffff'
bg: '#efefef'
txt_color: '#555555'
font_family: 'Helvetica Neue'
````## Usage
Create your twig
````
{% block subject %}
Subject of mail
{% endblock %}{% block body %}
{% embed "DonkeyCodeMailBundle:Mails:layout.html.twig" %}
{# For sf4 #}
{% embed "@DonkeyCodeMail/Mails/layout.html.twig" %}
{% block title %}Header{% endblock %}
{% block content %}
Body Of mail
{% endblock %}{% endembed %}
{% endblock %}
````Send it simply
````
$mailer = $this->getContainer()
->get('donkeycode.mailer')
->createMessage()
->setTemplate('YourBundle:Mails:invoices.html.twig', [
'invoices' => $invoices,
])
->setTo($destMail)
->send();
````