Answer the question
In order to leave comments, you need to log in
How to send email?
controller
$data = $request->all();
$result = Mail::send('site.email',['data'=>$data], function($message) use ($data) {
$mail_admin = env('MAIL_ADMIN');
$message->from($data['email'],$data['name']);
$message->to($mail_admin,'Mr. Admin')->subject('Question');
});
if($result) {
return redirect()->route('home')->with('status', 'Email is send');
}
MAIL_DRIVER=mail
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
[email protected]
<h1> {{ $data['name'] }} </h1>
<div>{{ $data['text'] }}</div>
Answer the question
In order to leave comments, you need to log in
An error due to the fact that you have invalid information in one of the headers, for example from or to. Check the validity of variables and finalized headers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question