Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
警告:phpmailer中的fsockopen()错误_Php_Email_Phpmailer - Fatal编程技术网

警告:phpmailer中的fsockopen()错误

警告:phpmailer中的fsockopen()错误,php,email,phpmailer,Php,Email,Phpmailer,我开发了一个PHP系统,需要向用户发送电子邮件。发件人正在使用Outlook帐户,电子邮件收件人也在使用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 smt

我开发了一个PHP系统,需要向用户发送电子邮件。发件人正在使用Outlook帐户,电子邮件收件人也在使用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
警告:fsockopen()[]:未能
在第122行的C:\wamp\www\assetmanagementsystem\class.smtp.php中启用加密
警告:fsockopen()[]:无法
连接到tls://abc-smtp.mycompany.local:25 中的(未知错误)
C:\wamp\www\assetmanagementsystem\class.smtp.php,第122行
警告:fsockopen()[]:SSL:crypto
在第122行的C:\wamp\www\assetmanagementsystem\class.smtp.php中启用超时
它还表示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";   
$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=“资产管理系统”;
$mail->Subject=“库存减少通知”;
$mail->MsgHTML($message);
$mail->AddAddress(“assi@mycompany.com“,”资产管理系统“);
$mail->IsHTML(true);
如果(!$mail->Send())
echo“未发送消息
PHPMailer错误:”$邮件->错误信息; 其他的 回显“消息已发送”;

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

您确定端口是25,对于tls是465吗?请始终修复列表中的第一个错误。我将端口更改为465,并收到此错误。你知道为什么会这样吗?警告:fsockopen()[]:无法连接到tls://abc-smtp.mycompany.local:465 (由于目标计算机主动拒绝,无法建立连接。)在C:\wamp\www\assetmanagementsystem\class.smtp.php的第122行,然后返回到25并删除
$mail->SMTPSecure=“tls”或设置
$mail->SMTPSecure=“”你说@shiplu.mokadd.im是什么意思?如果我看起来像个傻瓜,我很抱歉。这是我第一次做电子邮件通知,希望你能帮助我。非常感谢。