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

$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->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
echo "Mailer Error: " . $mail->ErrorInfo;
echo "Message has been sent";

Edited by kesh1000: n/a

7 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.