Link to home
Start Free TrialLog in
Avatar of lebron letchev
lebron letchev

asked on

HOW ENABLE SMTP?

Dear all,

This script was working fine sometimes ago, but now it does not works, there is an error message:

Warning: mail(): SMTP server response: 554 5.5.4 Your webserver has sent too many non-authenticated messages. Please enable SMTP Authentication in your script/code to continue sending messages.

How I enable SMTP in this script?





<?php

if (isset($_POST['g-recaptcha-response'])) {

    $captcha_data = $_POST['g-recaptcha-response'];

}

// Se nenhum valor foi recebido, o usuário não realizou o captcha

if (!$captcha_data) {

    echo "Por favor, confirme o captcha.";

    exit;

}
$resposta = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LduXAcUAAAAAAD9VXEHrm-lL_Pg-YiWcCo2_bIS&response=".$captcha_data."&remoteip=".$_SERVER['REMOTE_ADDR']);
?>

<?php

//if ($resposta.success) {

//    echo "Obrigado por deixar sua mensagem!";

//} else {

//    echo "Usuário mal-intencionado detectado. A mensagem não foi enviada.";

//    exit;

//}

?>

<?php

if(isset($_POST['submit'])){


    $to = "contactme@quarup.com"; // this is your Email address

    $from = $_POST['xmail']; // this is the sender's Email address

    //$from = $_POST['contactme@quarup.com']; // this is the sender's Email address

    $first_name = $_POST['first_name'];

    $last_name = $_POST['last_name'];

      $xmail = $_POST['xmail'];

    $subject = "Form submission";

    $subject2 = "Copy of your form submission";

    $message = $first_name . " " . $last_name ."" .$xmail ." wrote the following:" . "\n\n" . $_POST['message'];

    $message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;

    $headers2 = "From:" . $to;

      ini_set("sendmail_from", "contactme@quarup.com");
            

    mail($to,$subject,$message,$xmail, $headers);

  //  mail($from,$subject2,$message2,$xmail,$headers2); // sends a copy of the message to the sender

    echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";

    // You can also use header('Location: thank_you.php'); to redirect to another page.

    }



      ?>

Thank you in advance
Avatar of Kimputer
Kimputer

If you're in full control of this web server, install this first: http://pear.php.net/package/Mail
Obviously, you have to get the authentication info from your provider. Then adjust your whole mail code to include authentication:
Take a look at the code here: http://pear.php.net/manual/en/package.mail.mail.factory.php and here http://pear.php.net/manual/en/package.mail.mail.send.php
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lebron letchev

ASKER

Thnak you
Many thanks