2015-11-15 177 views
-1

我使用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.dllextension=php_openssl.dll,它不能正常工作。

回答

0

您可能需要重新啓動Apache才能讓php.ini更改生效。

+0

我重新啓動Apache,沒有工作... – a86356

0

如果啓用擴展功能不起作用,請安裝dll或閱讀更多關於openssl here的信息。

相關問題