Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

280
Views
React Client to Laravel Backend - Mail is not being Sent

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));
    
        }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!