在laravel 5.2中发送队列电子邮件

时间:2016-08-23 03:26:13

标签: php email laravel-5

我已经设置了laravel配置,用于使用队列发送电子邮件。有我的队列表(作业),并迁移数据库,然后我配置我的.env文件,如下所示:

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=**database**

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_USERNAME=**myemail@astrnt.co**
MAIL_PASSWORD=**maypasseheh**
MAIL_ENCRYPTION=null

我的queue.php中的数据库配置:

'database' => [
    'driver' => 'database',
    'table' => 'jobs',
    'queue' => 'default',
    'expire' => 60,
],

然后在我的路线上,我做了一条这样的路线:

Route::get('sendqueue/mail',function()
{
    Mail::later(5,'view_email', ['msg' => 'Hisoka data from email queue...'], function($message)
        {
            $message->to('hyosoka187@gmail.com','From Maryadi_astronaut')->subject('test email');
        });

    return 'From route....';
});

然后我运行php artisan queue:listen,但邮件只是推送到数据库但从未发送到我的电子邮件。在我的数据库中,有一些尝试已由laravel完成: enter image description here

我在这里错过了一些配置...... ??? 在此先感谢.. :))

注意: 我在Windows 7中使用xampp运行这个laravel

有人Heeeelp ....:')

这是日志文件:

[internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#13 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\laravel\framework\src\Illuminate\Container\Container.php(507): call_user_func_array(Array, Array)
#14 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\laravel\framework\src\Illuminate\Console\Command.php(169): Illuminate\Container\Container->call(Array)
#15 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\symfony\console\Command\Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\laravel\framework\src\Illuminate\Console\Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\symfony\console\Application.php(794): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\symfony\console\Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\symfony\console\Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 C:\xampp\htdocs\TestQueue2\queuelagi\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 C:\xampp\htdocs\TestQueue2\queuelagi\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 {main}  

0 个答案:

没有答案