Laravel5.1 use a queue to send emails

Source: Internet
Author: User
Tags php cli email account
Laravel5.1 use a queue to send emails
First in '. the queue driver "QUEUE_DRIVER = database" laravel5.1 in the env file provides six drivers: 'sync', 'databse', 'beancalkd ', 'sqs', and 'Iron ', for details about 'redis ', refer to the official manual. in this example, the 'database' driver php cli is used to run "php artisan queue: tablephp artisan queue: failed-tablephp artisan migrate" to generate two tables, store the successful data and failed data of the queue and then in 'app/config/mail. set the sender's account and name in php' from '=> ['address' => 'XXX @ 163.com ', 'name' => 'fucket'] 'in '. "MAIL_DRIVER = smtpMAIL_HOST = smtp.163.comMAIL _ PORT = 25MAIL_USERNAME = email account MAIL_PASSWORD = email password MAIL_ENCRYPTION = null" _ confirm that your mailbox has enabled the SMTP service _ configure the send Route "Route:: get ('mail/queue ', function () {mail: later (5, 'emails. queued_email ', ["name" => "gewenrui"], function ($ message) {$ message-> to ('recipient mailbox', 'name ') -> subject ('theme ');}); return "get emails ";}); "Run 'php artisan queue: listen' under the new php cli template under 'Views/emails/queue 'to access the 'mail/queue' route. you can find 'processed: mailer @ handleQueuedMessage 'sent successfully

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.