I do not get the form emails even if it seems that if I send

0

I have a reseller with several domains in it, everything worked fine, until 5 days ago the emails stopped coming to my mail, everything works perfectly, the site sends me to the thank you page that I configured, but the email never arrives at the email account.

I show you my php file:

<?

    require_once "recaptchalib.php";

        // Recepcion de datos
        $nombre=$_POST['nombre'];
        $correo=$_POST['mail'];
        $telefono=$_POST['phone'];
        $mensaje=$_POST['mensaje'];
        $asunto='Página web de Starfix / Contacto';

         $secret = "xxxxxx";
        $response = null;
        // comprueba la clave secreta
        $reCaptcha = new ReCaptcha($secret);

        //Fin de recepcion de datos


        if ($_POST["g-recaptcha-response"]) {
            $response = $reCaptcha->verifyResponse(
            $_SERVER["REMOTE_ADDR"],
            $_POST["g-recaptcha-response"]
            );
         }


     if ($response != null && $response->success) {
        // Si el código es correcto, seguimos procesando el formulario como siempre
        // Accion de envio
    //------------------//
    $para='[email protected]';
    $mensaje='Mensaje de Starfix (Contacto):

    Nombre: '.$nombre.'

    Correo: '.$correo.'

    Teléfono: '.$telefono.'

    Mensaje: '.$mensaje.'

    ';

    $desde='From:StarFix.com <www.starfix.com.mx>';
     mail($para, $asunto,$mensaje, $desde);
    /* Redirect browser */
    header("Location: http://www.starfix.com.mx/gracias.html");

    exit;

      } else {
        // Si el código no es válido, lanzamos mensaje de error al usuario
         echo "Te Falto Seleccionar la casilla";
      }

      ?>
    
asked by Bruno Guevara 18.09.2017 в 18:41
source

1 answer

0

Greetings Bruno, the problem is that you redirect without waiting for mail() to complete the sending process. Try to do the following:

<?php

// Todo tu código

if ( mail( $destino, $asunto, $cuerpo, $cabecera ) ) {
    header("Location: $tu_web");
}

?>

That way if the answer of the mail() is true if it redirects, but it will not ... You tell us how it went to you

    
answered by 11.01.2018 / 16:42
source