Send email with PHP without waiting time

1

In several sites of my project, when sending a form, this also has the function of sending an email to 3 recipients

The fact is that it takes about 4-5 seconds to validate the form because the email is being sent.

What I need is to optimize my code to send the email faster

I do not use Ajax

<form action="borrar.php" method="post" name="formborrar" id="formborrar" style="padding: 20px 0 0 0;text-align: left;width: 100px;margin: initial;">
  <input type="text" name="id" value="<?php echo $id; ?>" style="display: none;">
  <p><input class="btn" onclick="security()" id="submit_value" value="Borrar Aviso" name="submit_value"></p>
</form>

File uploader.php

<?php
$para  = '[email protected]';
 
$titulo = 'Se ha borrado un aviso por ' . $usuario;
 
ob_start();

$mensaje = "Mensaje de ejemplo";

$cabeceras  = 'MIME-Version: 1.0' . "\r\n";
$cabeceras .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
$cabeceras .= 'From: <[email protected]>' . "\r\n";

mail($para, $titulo, $mensaje, $cabeceras);

I have omitted several inputs and information that is not very relevant

    
asked by Tefef 15.10.2018 в 13:21
source

0 answers