I am new to PHP and was trying to send myself a sample email through PHPmailer. I am using gmail's smtp server. I am trying to send a sample email from my gmail account to my yahoo account. But I am getting the error :
Mailer Error: SMTP connect() failed.
Here is the code :
<?php 
require "class.phpmailer.php"; 
$mail = new PHPMailer(); 
$mail->IsSMTP(); // send via SMTP 
$mail->Host = "ssl://smtp.gmail.com"; 
$mail->SMTPAuth = true; // turn on SMTP authentication 
$mail->Username = "myemail@gmail.com"; // SMTP username 
$mail->Password = "mypassword"; // SMTP password 
$webmaster_email = "myemail@gmail.com"; //Reply to this email ID $email="myyahoomail@yahoo.in"; // Recipients email ID $name="My Name"; // Recipient's name $mail->From = $webmaster_email; $mail->Port = 465; $mail->FromName = "My Name"; $mail->AddAddress($email,$name); $mail->AddReplyTo($webmaster_email,"My Name"); $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML $mail->Subject = "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"; 
} 
?>
I am using a WAMP server on a Windows 7 64-bit machine so what could be the problem? Please help me solve this. Thanks!