Reputation: 597
here is my php code:
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->CharSet="UTF-8";
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = '[email protected]';
$mail->Password = 'pw';
$mail->SMTPAuth = true;
$mail->From = '[email protected]';
$mail->FromName = 'Clubbed In';
$mail->AddAddress('[email protected]');
$mail->AddReplyTo('[email protected]', 'Information');
$mail->IsHTML(true);
$mail->Subject = "PHPMailer Test Subject via Sendmail, basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->Body = "Hello";
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}
I followed a Gmail PHPMailer tutorial, I have no idea what is wrong? Can someone please help?
Upvotes: 0
Views: 2206
Reputation: 3128
Did you enable openssl on your php.ini?
Go to PHP.ini and find a line called
;extension=php_openssl.dll
and remove the semi colon in the beginning of the line.
Stop the Apache server and all servers, start them again, and try it again.
Upvotes: 2