sfcod/email-engine 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sfcod/email-engine

最新稳定版本:1.2.0

Composer 安装命令:

composer require sfcod/email-engine

包简介

Email engine for Symfony

README 文档

README

Scrutinizer Code QualityCode Climate

Provides possibility to send parametrized emails with attachments using queue of senders+repositories combination.

Config:

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: <entity_class>, 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 <entity_class> implements SfCod\EmailEngineBundle\Entity\EmailEntityInterface

Usage:

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).

统计信息

  • 总下载量: 2.18k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-19