Reputation: 714
But its showing
View [Mail] not found.
<?php
Route::get('/', function () {
return view('welcome');
});
Route::Get('/email','EmailController@index');
<?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
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
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