Answer the question
In order to leave comments, you need to log in
How to set up sending mail through the postal address on the server in laravel application?
For example, you have a website yoursite.ru and, accordingly, you have mail, for example, [email protected]
So, how can you send messages through it? What to include in . env (as far as I understand, the driver is mail)
MAIL_DRIVER=mail
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
public function callback (Request $request) {
$this->validate($request, [
'name' => 'required|min:1',
'tel' => 'required',
]);
Mail::send('emails.callback', [
'tel' => $request->tel,
'name' => $request->name
], function($mail) use($request) {
$mail->from('[email protected]', $request->name);
$mail->to('[email protected]')->subject('Обратный звонок');
});
return response()->json([
'message_sent' => 'Заявка принята! Скоро мы с вами свяжемся!'
]);
}
Answer the question
In order to leave comments, you need to log in
Turn on debug APP_DEBUG=true
and see more.
PS
This package is required to be installed - https://github.com/barryvdh/laravel-debugbar
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question