Failed to add recipient: @localhost [SMTP: Invalid response code received from server (code: 555, response: 5.5.2 Syntax error. v9sm2318990paz.6)]
I have tried using the if-else statement for this purpose. Here's the code I wrote:
- Code: Select all
<?php
//Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");
// email value sent from HTML form
$email_to=$_POST['email'];
// table name
$tbl_name="registration";
if($mysql1 = "SELECT ID,Email,Password FROM $tbl_name WHERE Email='$email_to' ORDER BY ID DESC ")
{
$selectemail = mysql_query($mysql1);
$shah = mysql_fetch_array($selectemail);
$EMAIL = $shah['Email'];
$UID = $shah['ID'];
$password = $shah['Password'];
require_once "/home/computat/php/Mail.php";
$from = "abhishekagrawal.988@gmail.com";
$to = $EMAIL;
$subject = "Your password for www.computationalphotography.in";
$body = "Your password for logging on to our website www.computationalphotography.in is:\n$password\r\nIf you have any additional queries, kindly write to us at abhishekagrawal.988@gmail.com\r\n\nThanks & Regards\nThe Computational Photography Team\n";
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "abhishekagrawal.988@gmail.com"; //
$password = "*********";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p></p>");
}
}
else{
echo "<b><center>Email not found in the database</center></b>";
}
/*


