elfuvo / yii2-postman
从不同来源收集电子邮件以进行邮件发送
0.0.2
2021-06-20 13:14 UTC
Requires
- php: >=7.1.0
- ext-ctype: *
- ext-dom: *
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- ext-pcre: *
- ext-reflection: *
- yiisoft/yii2: ~2.0.12
- yiisoft/yii2-queue: ~2.0.0
- yiisoft/yii2-swiftmailer: ~2.0.0
Requires (Dev)
- codeception/codeception: ^4.0
- codeception/module-asserts: ^1.2
- codeception/module-cli: ^1.0
- codeception/module-filesystem: ^1.0.0
- codeception/module-yii2: ^1.1
- symfony/browser-kit: >=2.7 <=4.2.4
This package is auto-updated.
Last update: 2024-09-20 20:42:22 UTC
README
要求
- PHP >=7.1
安装
安装此扩展的首选方法是通过 Composer.
运行以下命令之一
php composer.phar require --prefer-dist elfuvo/postman "~0.0.2"
或将其添加到 composer.json
"elfuvo/postman": "~0.0.2"
使用
在常用配置中定义类
[
'container' => [
'definitions' =>[
\elfuvo\postman\processor\ProcessorInterface::class => [
'class' => \app\modules\postman\processor\MailProcessor::class,
'collectors' => [
\elfuvo\postman\collector\TextInputCollector::class,
],
],
\elfuvo\postman\result\ResultInterface::class => \elfuvo\postman\result\CacheContinuesResult::class,
],
]
];
为了使用 DatabaseContinuesResult,请将迁移路径 "@elfuvo/postman/migrations" 添加到控制台配置中。
[
'controllerMap' => [
'migrate' => [
'class' => \yii\console\controllers\MigrateController::class,
'migrationTable' => '{{%migration}}',
'useTablePrefix' => true,
'interactive' => false,
'migrationPath' => [
'@elfuvo/postman/migrations',
],
]
]
];
在后端配置中定义模块
[
'modules' => [
'postman' => [
'class' => \yii\base\Module::class,
'controllerNamespace' => 'elfuvo\postman\controllers\backend',
],
]
];
如果您不想使用队列作业,请创建自己的控制器并将 useQueue 属性设置为 IndexAction 的 false
class DefaultController extends Controller { /** * @return array|string[] */ public function actions() { return [ 'index' => [ 'class' => IndexAction::class, 'view' => '@app/modules/postman/views/backend/default/index', // path to custom template 'useQueue' => true, // use or not Yii2 queue for mailing ], 'progress' => ProgressAction::class, 'view' => ViewAction::class, ]; } }
您可以创建自定义的电子邮件收集器,请参阅示例。创建收集器后,将其添加到常用配置中。