simply-move-public/elastic-email-bundle

Symfony 的 ElasticEmail Bundle

此软件包的官方仓库似乎已不存在,因此软件包已被冻结。

dev-master 2018-02-23 08:02 UTC

This package is not auto-updated.

Last update: 2020-06-06 08:43:29 UTC


README

SimplyElasticEmailBundle 是一个适用于 Symfony > 2.8 的 bundle,允许您调用 ElasticEmailBundle API。请参阅文档:[https://api.elasticemail.com/public/help#Email_Send](https://api.elasticemail.com/public/help#Email_Send)

先决条件

  • Symfony > 2.8
  • PHP > 7.0

安装

composer require simply-move-public/elastic-email-bundle

添加到 AppKernel.php

new ElasticEmailBundle\ElasticEmailBundle()

加载 services.yml

    - { resource: "@ElasticEmailBundle/Resources/config/services.yml" }

在 parameters.yml 中添加 API 密钥

elasticemail_api_key: XXXXX-XXXXX-XXXXXX

文档

电子邮件

  • 发送电子邮件
$this->getContainer()
->get('simply.elasticemail')
->email()
->Send([
    'bodyHtml'   => $ew->getBodyHtml(),
    'bodyText'   => $ew->getBodyText(),
    'subject'    => $ew->getSubject(),
    'from'     => $ew->getFromEmail(),
    'fromName' => $ew->getFromName(),
    'msgTo'      => $ew->getToEmail(),
    'isTransactional' => true
]);
  • 状态
$this->getContainer()
->get('simply.elasticemail')
->email()
->Status($messageId)
  • 获取状态
$this->getContainer()
->get('simply.elasticemail')
->email()
->GetStatus($transactionId, [
    'XXX' => 'xxxx'
])
  • 查看
$this->getContainer()
->get('simply.elasticemail')
->email()
->View($messageId)