Error with phpmailer form Deprecated: Function split

1

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 :(";
}
?>
    
asked by José Carlos Castillo 09.09.2017 в 02:08
source

1 answer

1

The problem

It's serious and it's critical.

Error messages indicate that your PHPMailer installation is not up to date.

In 2016, Dawid Golunski discovered two security flaws in PHPMailer, reported in legalhackers:

Both failures were addressed in the PHPMailer Wiki on Github: About the CVE 2016 10033 and CVE 2016 10045 vulnerabilities

The solution

It's urgent

Unpatched software can be dangerous to your website, as malicious users can exploit vulnerabilities in these files to introduce malicious code into your site.

Therefore it is urgent to update your version of PHPMailer.

How to update?

About the update, everything is explained by the creators on GitHub: PHPMailer Upgrading

There are several ways.

Option 1: use composer (recommended)

The most recommended by creators is to use composer :

  

We recommend that you upload PHPMailer through composer, using   your standard autoloader, which you probably will not need to load if you already   he is using it, but in case he is not, he will have to   yourself:

require 'vendor/autoload.php';

Option 2: Manually (not recommended)

  

If you are not using composer , you can load the classes manually,   depending on what you are using:

require 'src/PHPMailer.php';
require 'src/SMTP.php';
require 'src/Exception.php';

The advantage of using composer is that it will keep you PHPMailer updated.

If you do it manually you will have to be aware of future updates.

Especially when you start in PHP the composer may sound like Chinese, but it is not that complicated to install it on your server if it is not and then everything is easier.

Any questions about

answered by 09.09.2017 / 18:26
source