Ripon Uddin
Ripon Uddin

Reputation: 714

View [Mail] not found Laravel 5.4

Am trying to send email with Laravel 5.4

But its showing

View [Mail] not found.

My Route code view below :

<?php

Route::get('/', function () {
   return view('welcome');
});

Route::Get('/email','EmailController@index');

My EmailController Code below :

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Mail;
class EmailController extends Controller{
public function index()
  {
    Mail::send(['text'=>'Mail'],['name','Ripon Uddin Arman'],function($message){
        $message->to('[email protected]')->subject("Email Testing with Laravel");
        $message->from('[email protected]','Creative Losser Hopeless Genius');
    });
  }
 }

How can i solve this ?

Upvotes: 0

Views: 17575

Answers (2)

Arvind K.
Arvind K.

Reputation: 1294

In Laravel 5 one can use Mail::raw(). One can also use the Mail::send() method with empty array as first argument, such as:

Mail::send([], [], function ($message) {
})

See: Laravel mail: pass string instead of view.

Upvotes: 3

Dee Nix
Dee Nix

Reputation: 168

In laravel 5.4 to 5.6 this send mail function is given as

public function send($view, array $data = [], $callback = null)

where first arg will be name of your view. So create a mail.blade.php in view folder write some text or html and save. Make change in your function as given below:

Mail::send('mail',['name','Ripon Uddin Arman'],function($message){
    $message->to('[email protected]')->subject("Email Testing with Laravel");
    $message->from('[email protected]','Creative Losser Hopeless Genius');
});

Pass the view name as first arg.

Hope this help :)

Upvotes: 0

Related Questions