Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

How to Send Emails in Laravel
Jan 05, 2018 @ 12:25:33

The TutsPlus.com site has posted a tutorial for the Laravel users out there showing you how to send emails with built-in functionality via the framework's Mail API.

In this article, we're going to explore the Mail API in the Laravel web framework. Laravel takes advantage of the popular SwiftMailer library, which is easy to use and comes with a variety of email drivers to choose from. In the latter stages of the article, we'll go through an in-depth demonstration of the concepts discussed in the first half of the article.

The tutorial starts with the setup and configuration you'll need to get the mail system up and running. They don't help you set up the backend (like sendmail or Mailgun) but they do describe the options in the configuration required for methods like SMTP sending and local sending. Next they show an example of a "mailable" class that creates a "demo" email and defines various settings including the "from" address, the content (from a view), variables to pass to the view and an image attachment. The view for the example is also included, making use of the Blade templating to replace placeholders with variable values.

tagged: email laravel tutorial mailable class example

Link: https://code.tutsplus.com/tutorials/how-to-send-emails-in-laravel--cms-30046