Level 60
https://laravel.com/docs/5.8/mail#sending-mail read carefully
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to send a email when a booking is created, but my mailtrap is not catching anything. Any ideas?
Here is my .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=null
Here is the Controller
public function store(Request $request)
{
request()->validate([
'carNumber' => 'required',
'carSize' => 'required',
'carType' => 'required',
'carSubtype' => 'required',
'carColor' => 'required',
'name' => 'required',
'socialId' => 'required',
'email' => 'required|email',
'phone' => 'required',
'dropOffTime' => 'required',
'pickUpTime' => 'required',
'flightNumber' => 'required',
]);
$booking = Booking::create([
'carNumber' => request('carNumber'),
'carSize' => request('carSize'),
'carType' => request('carType'),
'carSubtype' => request('carSubtype'),
'carColor' => request('carColor'),
'name' => request('name'),
'socialId' => request('socialId'),
'email' => request('email'),
'phone' => request('phone'),
'dropOffDate' => request('dropOffDate'),
'dropOffTime' => request('dropOffTime'),
'pickUpDate' => request('pickUpDate'),
'pickUpTime' => request('pickUpTime'),
'flightNumber' => request('flightNumber'),
]);
Mail::to($booking)->sent(new BookingConfirmed($booking));
if (request()->wantsJson()) {
return response($booking, 201);
}
return redirect('/');
}
Please or to participate in this conversation.