strong2much/yii2-bounce

处理邮件退订的辅助类

安装: 29

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

dev-master 2016-07-31 17:57 UTC

This package is auto-updated.

Last update: 2024-09-05 06:59:35 UTC


README

处理邮件退订的辅助类。

安装

使用composer安装包

{
    "require": {
       "strong2much/yii2-bounce": "dev-master"
    }
}

Or

$ composer require strong2much/yii2-bounce "dev-master"

在配置文件中使用以下代码。

'bounce' => [
    'class' => 'strong2much\bounce\BounceManager'
]

为了自动识别翻译,请将此组件放入配置的bootstrap中

'bootstrap' => ['bounce'],

否则请在i18n组件中自行指定

'i18n' => [
    'translations' => [
        ...
        'bounce*' => [
            'class' => 'yii\i18n\PhpMessageSource',
            'basePath' => '@strong2much/bounce/messages',
        ],
        ...
    ],
],

您可以使用以下方式使用它

//To add bounce report
$data = Yii::$app->bounce->parseMessage($emailMessage);
foreach($data as $bounceData) {
    Yii::$app->bounce->pushReport($bounceData['recipient'], $bounceData);
}

//To check bounce report
if(!Yii::$app->bounce->hasReport($email)) {
    //do some logic
}

为了使用全部功能,您需要应用迁移。