not sure why this mail isnt working. when i run this code i get a error:
Mail error SMTP Error: Could not connect to SMTP host.
i set up a if test which is failing. doesnt any one know how to connect to smtp host? does this smtp means the files? bc i did include it top of the page. and also phpmailer.php
...
require_once('require/class.phpmailer.php');
require_once('require/class.smtp.php');
...
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "username@gmail.com"; //yourname@yourdomain
$mail->Password = "password"; //password
$mail->AddAddress($email_p, $first_name_db);
$mail->Subject = "Forgot password";
$mail->IsHTML(true);
$mail->Body = "message";
$mail->From = "username@gmail.com";
$mail->FromName = "fromname";
$mail->wordWrap = 50;
if(!$mail->send())
{
$e .= "Mail error ".$mail->ErrorInfo;
echo"$e";
}
else
{
echo "E-mail has be sent to <b><u>$email_p</u></b>";
}