0

我开发了一个需要向用户发送电子邮件的 PHP 系统。发件人正在使用 Outlook 帐户,电子邮件收件人也是如此。我正在使用 PHPmailer 发送电子邮件。

仅供参考,我的 SMTP 有效,因为我是从公司 IT 部门获得的。

这是我在 php.ini 中更改的内容:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = abc-smtp.mycompany.local
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = abc@mycompany.com

当我运行代码时,我得到了这个 3 错误:

Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: Failed to 
enable crypto in C:\wamp\www\assetmanagementsystem\class.smtp.php on line 122

Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to
connect to tls://abc-smtp.mycompany.local:25 (Unknown error) in
C:\wamp\www\assetmanagementsystem\class.smtp.php on line 122

Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: SSL: crypto
enabling timeout in C:\wamp\www\assetmanagementsystem\class.smtp.php on line 122

它还说 PHPMailer 错误:SMTP 错误:无法连接到 SMTP 主机。

这是我的电子邮件编码:

    $mail  = new PHPMailer();
$mail->IsSMTP();

$mail->SMTPAuth   = true;                  
$mail->SMTPSecure = "tls";                
$mail->Host       = 'abc-smtp.mycompany.local';      
$mail->Port       = 25;                   


    $mail->From       = "assi@mycompany.com";
    $mail->FromName   = "Asset Management System";
$mail->Subject    = "Notification on less of stock";
$mail->MsgHTML($message);

$mail->AddAddress("assi@mycompany.com","Asset Management System");
$mail->IsHTML(true); 
    if(!$mail->Send())
    echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
         else
    echo "Message has been sent";   

另外,我在 PHP.ini 中启用了我的 OpenSSL。有人可以帮我吗 ?为什么我有这个错误以及如何克服它。我真的需要解决这个问题。提前致谢。

4

0 回答 0