Firstly, I am pretty new in ReactJS and have no prior experience in Laravel, so the question may seem irrelevant or pointless, so any correction is appreciated. I am trying to send an email via using a form on the client side. When I submit the form, the response seems 200 OK and all the data is being sent. But I don't get an email in the account which I am supposed to. Here is the sendMail function on the client, and backend function which is supposed to get post request and send an email with the data in request.
FRONTEND
const sendMail = async (e) => {
e.preventDefault();
const reservationdetail = JSON.stringify(allValues);
axios
.post('http://panel.xyz.com/api/send-reservation', {
reservationdetail: reservationdetail
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})
.then(function () {});
$('.reservation-tab-area').addClass('d-none');
dispatch(changePage(3));
}
BACKEND
public function addReservation(Request $request)
{
$jsondata = $request;
Reservation::create(['reservationdetail' => $jsondata->reservationdetail]);
$reservationdetail= $jsondata->reservationdetail;
$email = 'rezervasyon@xyz.com';
$rezerve= json_decode($reservationdetail);
$offer = [
'title' => 'İnfo Contact',
'name' => $rezerve->name,
'surname' => $rezerve->surname,
'cityselect' => $rezerve->cityselect,
'phone' => $rezerve->phone,
'mail' => $rezerve->mail,
'message' => $rezerve->message,
'deliveryCity' => $rezerve->deliveryCity,
'returnCity' => $rezerve->returnCity,
'contactViaEmail' => $rezerve->contactViaEmail,
'contactViaPhone' => $rezerve->contactViaPhone,
'contactViaWhatsapp' => $rezerve->contactViaWhatsapp,
'total' => $rezerve->totalAmount,
'enddate' => $rezerve->endDate,
'startdate' => $rezerve->startDate,
'carname' => $rezerve->carselect->name,
'carclass' => $rezerve->carselect->class,
];
Mail::to($email)->send(new OfferMail($offer));
}