我使用phpmailer發送emails.but遇到一些麻煩。爲什麼phpmailer功能不起作用
$mail = new PHPMailer();
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.qq.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '100****@qq.com'; // SMTP username
$mail->Password = 'w******'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('10****[email protected]', 'Mailer');
$mail->addAddress('1***[email protected]', 'Joe User'); // Add a recipient
$mail->addReplyTo('1*****[email protected]', 'Information');
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
它顯示消息無法發送。
Mailer Error: Extension missing: openssl
,我改變php.ini文件;extension=php_openssl.dll
到extension=php_openssl.dll
,它不能正常工作。
我重新啓動Apache,沒有工作... – a86356