So, I’m assuming that you know how to create a basic laravel project that’s why I’m starting with real action for sending mails.
First of all create view, which you want to send as a mail. Here I have a sample view with “Hello World!” text.
After creating view just create a controller. I’m creating controller named “SendMailController” .
Here is the code of controller :
Create a route for calling controller’s method.
Finally configure your mail credentials in .env file. I’m using mailtrap as a mail host.
For those who don’t know about mailtrap, let me explain in short: mailtrap is mail host for testing your emails, it doesn’t send mails to actual email address, instead it stores email in inbox of your mailtrap account.
Finally the results 🥳.
So i hope you liked this way of sending the mails.