I'm using PHPMailer on my website, but it returns an error:
You must provide at least one recipient email address. I've checked out the following pages looking for answers: https://github.com/PHPMailer/PHPMailer/issues/441 https://github.com/PHPMailer/PHPMailer/issues/429
None of those solved my problem.
This is the way it's set up:
<?php
$conn=mysqli_connect("localhost","sar","siarth2");
mysqli_select_db($conn,"test");
$Email=$_REQUEST["Email"];
$query=mysqli_query($conn,"select * from user where Email='$Email'");
$row=mysqli_fetch_array($query,MYSQLI_ASSOC);
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->Host = "ssl://smtp.gmail.com";
$mail->SMTPAuth = TRUE;
$mail->Username = "sidban5679@gmail.com";
$mail->Password = "password";
$mail->Port =466;
$mail->From = "sidban5679@gmail.com";
$mail->FromName = "Sidharth";
$mail->AddAddress($row["Email"]);
$mail->isHTML(true);
$mail->Subject = "Password";
$mail->Body = "<i>this is your password:</i>".$row["Password"];
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent successfully";
}
SQL Code
INSERT INTO user
(Password
, FirstName
, LastName
, Email
) VALUES
('friends34', 'Kaser', 'Baddal', 'banh5@gmail.com');