yarcode / yii2-async-mailer Goto Github PK
View Code? Open in Web Editor NEWAsync mailer decorator for Yii2
License: MIT License
Async mailer decorator for Yii2
License: MIT License
Hi, i'm currently trying to implement your library to my project.
I'm use PostgreSQL as my database connection and got this error message
PHP Notice 'yii\base\ErrorException' with message 'unserialize(): Error at offset 112 of 116 bytes'
in /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/bazilio/yii2-async/transports/AsyncMysqlTransport.php:88
Here's the stack trace
Stack trace: #0 [internal function]: yii\base\ErrorHandler->handleError(8, 'unserialize(): ...', '/Users/samdgea/...', 88, Array)
#1 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/bazilio/yii2-async/transports/AsyncMysqlTransport.php(88): unserialize('O:46:"YarCode\\Y...')
#2 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/bazilio/yii2-async/AsyncComponent.php(48): bazilio\async\transports\AsyncMysqlTransport->receive('mailer', false)
#3 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yarcode/yii2-async-mailer/src/MailerCommand.php(24): bazilio\async\AsyncComponent->receiveTask('mailer')
#4 [internal function]: YarCode\Yii2\AsyncMailer\MailerCommand->YarCode\Yii2\AsyncMailer\{closure}(Object(React\EventLoop\Timer\Timer))
#5 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/react/react/src/EventLoop/Timer/Timers.php(90): call_user_func(Object(Closure), Object(React\EventLoop\Timer\Timer))
#6 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/react/react/src/EventLoop/StreamSelectLoop.php(177): React\EventLoop\Timer\Timers->tick()
#7 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yarcode/yii2-daemon/src/DaemonCommand.php(25): React\EventLoop\StreamSelectLoop->run()
#8 [internal function]: YarCode\Yii2\Daemon\DaemonCommand->actionDaemon()
#9 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('daemon', Array)
#12 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('daemon', Array)
#13 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('mailer/daemon', Array)
#14 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('mailer/daemon', Array)
#15 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#16 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/yii(20): yii\base\Application->run()
#17 {main}
Here's my code
private function _sendVerificationEmail($user, $subject = "Please validate your account")
{
$message = Yii::$app->mailer->compose()
->setFrom('[email protected]')
->setTo($user->email_address)
->setSubject($subject)
->setTextBody("Hi, this is your verification code: " . $user->email_verification_hash . "\nPlease ignore if you did not request it");
return Yii::$app->mailer->send($message);
}
and this is my configuration file
$config = [
....
'mailer' => [
'class' => \YarCode\Yii2\AsyncMailer\Mailer::class,
'syncMailer' => [
'class' => yii\swiftmailer\Mailer::class,
'useFileTransport' => true,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.mailtrap.io',
'username' => 'xx',
'password' => '9xx',
'port' => '2525',
'encryption' => 'tls',
],
],
],
...
];
Hi, i'm currently trying to implement your library to my project.
Can i ask question, why in MailerCommand class need to execute SELECT 1 from $app->db?
Actually my app has no database connection, except redis connection that this library needed.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.