hi everyone,

i am trying to use php mailer to configure emails in my website. im doing this website as my project so im using local wamp server.

since wamp is not mail server im trying to use gmail with it.

can anyone help me as to why im getting the following

SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.

here is my code

<?php
require("../phpmailer/class.phpmailer.php");
$mail = new PHPMailer(); 

$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;

//$mail->IsSMTP(); // send via SMTP
//IsSMTP(); // send via SMTP

$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "bla@gmail.com"; // SMTP username not desplayd for security
$mail->Password = ""; // SMTP password not desplayd for security
$webmaster_email = "kesh1000@gmail.com"; //Reply to this email ID
$email="kesh1000@hotmail.com"; // Recipients email ID
$name="Mukesh"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment(""); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.