Laravel Send Mail Without Mailable

Jayesh tharwani
2 min readNov 26, 2020

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.

hello_world.blade.php

After creating view just create a controller. I’m creating controller named “SendMailController” .

Command for creating controller.

Here is the code of controller :

SendMailController.php

Create a route for calling controller’s method.

web.php

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.

.env

Finally the results 🥳.

So i hope you liked this way of sending the mails.

--

--