https://github.com/sfcod/email-engine
https://github.com/sfcod/email-engine
email-sender email-template php symfony symfony-bundle
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sfcod/email-engine
- Owner: sfcod
- Created: 2018-02-19T21:58:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-11T11:35:04.000Z (about 1 year ago)
- Last Synced: 2024-10-11T23:49:04.337Z (12 months ago)
- Topics: email-sender, email-template, php, symfony, symfony-bundle
- Language: PHP
- Size: 46.9 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Symfony Email Engine Bundle
===========================[](https://scrutinizer-ci.com/g/sfcod/email-engine/?branch=master)[](https://codeclimate.com/github/sfcod/email-engine)
Provides possibility to send parametrized emails with attachments using queue of senders+repositories combination.
#### Config:
```yaml
sfcod_email_engine:
main_sender: chained_sender
senders:
chained_sender:
chain:
senders: [db_swiftmailer_sender, twig_file_swiftmailer_sender]
twig_file_swiftmailer_sender:
sender:
class: SfCod\EmailEngineBundle\Sender\SwiftMailerSender
repository:
class: SfCod\EmailEngineBundle\Repository\TwigFileRepository
db_swiftmailer_sender:
sender:
class: SfCod\EmailEngineBundle\Sender\SwiftMailerSender
repository:
class: SfCod\EmailEngineBundle\Repository\DbRepository
arguments: { entity: , attribute: slug }
templates:
- SfCod\EmailEngineBundle\Example\TestTemplate
```Where "templates" section needed for "SfCod\EmailEngineBundle\Mailer\TemplateManager" service and for params autowiring/autoconfiguring as services.
Using which you can get all possible email template parameters, description, etc.And implements SfCod\EmailEngineBundle\Entity\EmailEntityInterface
#### Usage:
```php
use SfCod\EmailEngineBundle\Mailer\Mailer;
use SfCod\EmailEngineBundle\Example\TestOptions;
use SfCod\EmailEngineBundle\Example\TestTemplate;public function indexAction(Mailer $mailer) {
$options = new TestOptions('some message', 'attachment_path');
$template = new TestTemplate($options);
$mailer->send($template, 'example@email.com');
}
```If you want to use SfCod\EmailEngineBundle\Sender\SwiftMailerSender with SfCod\EmailEngineBundle\Repository\TwigFileRepository
then you have to implement SfCod\EmailEngineBundle\Template\TwigTemplateAwareInterface.And TestTemplate email will be sent using SwiftMailerSender and template data will be collected from DbRepository.
If it fails, will be used SwiftMailerSender+TwigFileRepository, because both of them listed in "chained_sender" (see config section).