Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

281
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda