Laravel provides a powerful and clean API over the SwiftMailer library with drivers for Mailgun, SMTP, Amazon SES, SparkPost, and send an email. With this API, we can send email on a local server as well as the live server.

Here is an example through the mail()

Laravel allows us to store email messages in our views files. For example, to manage our emails, we can create an email directory within our resources/views directory.

Example

                                        

public function sendEmail(Request $request, $id)
{
      $user = Users::find($id);
      Mail::send('emails.reminder', ['user' => $user], function ($mail) use ($user)  {
           $mail->from('[email protected]', 'Feedback');
           $mail->to($user->email, $user->name)->subject('Thanks Message');
      });
}

Suggest An Answer

No suggestions Available!