wvdongen/cakephp-sparkpost

SparkPost CakePHP 插件

安装量: 4,771

依赖者: 0

建议者: 0

安全性: 0

星标: 1

关注者: 2

分支: 1

开放问题: 1

类型:cakephp-plugin

dev-master 2018-01-19 16:22 UTC

This package is not auto-updated.

Last update: 2024-09-20 20:10:59 UTC


README

安装

您可以将插件克隆到项目中

cd path/to/app/Plugin
git clone https://github.com/wvdongen/cakephp-sparkpost.git SparkPost

您还可以使用 composer 安装此插件。只需将新要求添加到您的 composer.json 文件中

"require": {
    ...,
    "wvdongen/cakephp-sparkpost": "*"
},

在 app/Config/bootstrap.php 中启动插件

CakePlugin::load('SparkPost');

配置

创建文件 app/Config/email.php,使用 EmailConfig 类。

<?php
class EmailConfig {
  public $sparkPost = array(
    'transport' => 'SparkPost.SparkPost',
    'emailFormat' => 'both',
    'sparkpost' => array(
        'api_key' => 'YOUR_API_KEY',
        'timeout' => '120', // optional, set non-default timeout
        'options' => [
           // See https://developers.sparkpost.com/api/transmissions.html
          'transactional' => false,
        ],
        'log' => array( // optional, write to CakeLog
            'level' => 'debug', // optional, see Psr\Log\LogLevel, but cannot use class constants here.
            'format' => '{response}', // optional, string with token substitution, see https://github.com/guzzle/guzzle/blob/master/src/MessageFormatter.php#L12'.
        ),
    ),
  );
}

要求

CakePHP 2.0+