I have used the PHP mailer function to send a mail. This code has worked on XAMPP and 000webhost.com, but its not working on aws.
<?php
require("\PHPMailer\PHPMailer\class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
//$mail->SMTPDebug = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "****@gmail.com"; // Enter your SMTP username
$mail->Password = "************"; // SMTP password
$webmaster_email = $_POST['email']; //Add reply-to email address
$email= "***@gmail.com"; // Add recipients email address
$name= "Recipient's name"; // Add Your Recipient’s name
$mail->From = $webmaster_email;
$mail->FromName = $_POST['name'];
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,$_POST['name']);
$mail->WordWrap = 500; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "website inquiry - Support";
$mail->Body = nl2br($_POST['message']);
$mail->AltBody = nl2br($_POST['message']); //Plain Text Body
if($mail->Send())
echo 1;
else
echo 0;
?>
Please tell me where I am going wrong. When I am executing this code on aws..its echoing 0
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire