simplement/mailqueue
最新稳定版本:v0.2
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);
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-09-16