SMTP Gmail Server SSL Error $mail = new phpmailer; $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 1;// enables SMTP debug information (for testing) $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 = "un"; // GMAIL username $mail->Password = "pwd"; // GMAIL password $mail->SetFrom('test@gmail.com', 'Bharanidharan'); $mail->AddReplyTo("test@gmail.com","Vishal Kumar"); $mail->AddAddress("test@gmail.com","Bharani"); $mail->Subject = "Hey, check out"; $body = "hey, check email"; $mail->MsgHTML($body); $address = "test@gmail.com"; $mail->AddAddress($address, "test"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; }