simplement/mailqueue
Composer 安装命令:
composer require simplement/mailqueue
包简介
Simple queue for outcoming mails for Nette Framework.
README 文档
README
Simplement\MailQueue is a small extension for Nette Framework, which will wrap default Nette SendmailMailer or SmtpMailer by it's own Mailer class. All outcoming mails are then redirected into mail queue, which is by default implemented by Kdyby\Doctrine entity.
If you don't wan't to use default mail queue, you can simply implement your own by extending Simplement\MailQueue\IEntry and Simplement\MailQueue\IQueue interfaces and create e.g. file system mail queue instead of database system one.
Then you can setup cron, which will in given inteval send dose of fronted mails e.g. using command
php www/index.php mailqueue:sendfronted
Requirements
Nette Framework and Kdyby\Console, recommended Kdyby\Doctrine.
Benefits
- All outcoming mails aren't sent inmediatelly, but they are moved to queue -> response to client is much faster.
- You don't have to update you current app code. All mails are after setting this extension automatically redirected into mail queue.
- If the app is unnable to send mail (due to loss of internet connection etc.) app will not crush, but reschedule mail and try it send again in set interval.
- You can set priority to each mail.
- You can set default
fromemail address, which will be used if mail doesn't have it set.
Configuration
extensions: # Add MailQueue Extension mailqueue: Simplement\Bridges\MailDI\MailQueueExtension mailqueue: timeLimit: 30 # Max executin time of cron script mailLimit: 50 # Max number of mails sent peer one cron call attemptLimit: 5 # Max number of attempts to send mail rescheduleTime: +30 minutes # If unnable to send mail, try nex attempt after ... defaultSender: 'MyAwesomeApp <myawesomeapp@mail.com>' # Optional # If you want to use default Doctrine Mail Queue services: mailQueue: Simplement\Bridges\DoctrineORM\MailQueue doctrine: metadata: Simplement: %appDir%/../vendor/simplement/mailqueue/src/Bridges/DoctrineORM/Entity
Usage
$message = new Nette\Mail\Message; : /** @var Nette\DI\Container $container */ $container = ...; $mailer = $container->getByType('Nette\Mail\IMailer'); or $mailer = $container->getService('mail.mailer'); or $mailer = $container->getService('nette.mailer'); /** @var Simplement\MailQueue\Mailer $mailer */ $mailer->send($message, $priority = 1, $useQueue = TRUE);
simplement/mailqueue 适用场景与选型建议
simplement/mailqueue 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 09 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mail」 「queue」 「nette」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 simplement/mailqueue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 simplement/mailqueue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 simplement/mailqueue 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Nette Framework adapter for I18n package
Build forms from schema
Mail libraries used by Zimbra Api
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-09-16