定制 hakito/cakephp-mailqueue-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

hakito/cakephp-mailqueue-plugin

Composer 安装命令:

composer require hakito/cakephp-mailqueue-plugin

包简介

Plugin to store mail in a queue for later sendout

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

CakePHP 5.x plugin to store mail in a queue for later sendout.

When working with emails on a webservice sending email blocks the http request until the email is actually sent out. This can be frustrating for a user especially if the smtp server does not respond promptly.

With this plugin you can save the mail to a local queue file and invoke the actual transport for example with a cron fired cake shell command.

Installation

If you are using composer simply add it with:

composer require hakito/cakephp-mailqueue-plugin

Otherwise download the plugin to app/Plugin/Mailqueue.

Load the plugin in your bootstrap method

$this->addPlugin('MailQueue');

Configuration

Add a transport entry to your app_local.php

'EmailTransport' => [
    'MailQueue' => [
        // required
        'className' => \MailQueue\Mailer\Transport\QueueTransport::class,
        'queueFolder' => TMP . 'mailqueue', // storage location for mailqueue

        // optional:
        'requeue' => [300, 500, 1000] // requeue after x seconds in case of an error
    ]
],

'Email' => [
    'default' => [
        'transport' => 'MailQueue',
    ],
    'smtp' => [
        // configure your real mailer here
    ]
]

Queue a mail

Send mail to the queue as usually in cake

$mailer = new Mailer('default');
// place your content in $email
$mailer->deliver();

Do the real sendout

Use cake shell to do the real sendout. The shell script requires 2 arguments. The first is the name of your queue configuration and the second the name of the config to use for the real sendout.

In your app directory execute:

bin/cake MailQueue SendMail smtp

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2014-09-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固