How to send an email? [duplicate]

-2

I need to make a quote that when entering the data I will save each quote with the same form, print the data on the screen but at the same time store them in a variable and when clicking on a button send it to the client an email with the data. I already know how to connect it and receive the input but I need to send that information by mail.

How do I do it?

    
asked by Alex Monroy 12.07.2017 в 03:20
source

1 answer

3

You can use the PHPmailer library to decompress your project folder and configure your necessary data in a php script. It is essential that your gmail account is configured for access to less secure connections.

    <?php
    
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    
    require ("class.phpmailer.php");
    require ("class.smtp.php");
    
    $mail = new PHPMailer(true);
    
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Port = 25;
    $mail->Host = "smtp.gmail.com";
    $mail->Username = "[email protected]"; 
    $mail->Password = "TU_PASSWORD"; 
     
    
    
     $mail->IsHTML(true);
    
    
    $mail->addAddress(CORREO_DEL_DESTINATARIO);
    
    $mail->Subject = "EL_asunto";
    $mail->Body = "EL_mensaje";
    
    
    $exito = $mail->Send();
    
    if($exito){
    echo 'El correo fue enviado correctamente';
    }else{
    echo 'Hubo un inconveniente. Intente de nuevo.';
    }
    
    ?>
    
answered by 12.07.2017 в 05:40