2015-11-15 129 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的信息。

相关问题