I want to send a form to a personal email, use an example of phpmailer that I saw in this forum, and it worked, the email is sent, but by showing the echo with the confirmation, first a couple of messages appear, which I do not want that they appear but I do not know how to remove them, I only send the message "We have received your message ..." and if the mail arrives well, I am interested in removing those messages from the echo
Deprecated: preg_replace (): The / e modifier is deprecated, use preg_replace_callback instead in /.../public_html/remodelacion/pcontacto/phpmailer/class.phpmailer.php on line 1432
Deprecated: Function split () is deprecated in /.../public_html/remodelacion/pcontacto/phpmailer/class.phpmailer.php on line 472
I leave the php code I am using but I do not think it has much to do with the error.
<?php
$nombre = $empresa = $correot = $asunto = $mensaje = $captcha = $para = NULL;
$nombre = $_POST["nombre"];
$empresa = $_POST["empresa"];
$correo = $_POST["correo"];
$asunto = $_POST["asunto"];
$mensaje = $_POST["mensaje"];
$captcha = $_POST["captcha"];
$para = '[email protected]';
$keySecret = "6LfFFi4UAAAAA..........................";
$verificacion = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$keySecret}&response={$captcha}");
$respGoogle = json_decode($verificacion);
if($respGoogle->success == true){
require"phpmailer/class.phpmailer.php";
$mail = new PHPMailer;
$mail->CharSet = 'UTF-8';
$mail->From = $correo;
$mail->FromName = $nombre;
$mail->addAddress($para, "NOMBRE");
$mail->addReplyTo($correo,$nombre);
$mail->addBCC("[email protected]");
$mail->isHTML(true);
$mail->Subject = $asunto;
$mail->Body = "
<h1>Correo de Prueba</h1>
Nombre: $nombre<br />
Empresa: $empresa<br />
Email: $correo <br />
Mensaje: $mensaje <br />
";
//Aquí es donde aparece el error, al enviar el mensaje
if(!$mail->send()) {
echo "Mensaje no Enviado vuelva a intentar";
} else {
echo "<b>Hemos recibido tu mensaje, te contestaremos lo más pronto posible</b>";
}
}
else if($respGoogle->success == false){
echo "Error. Google no validó el captcha :(";
}
?>