stream_socket_enable_crypto()错误在php邮件程序 [英] stream_socket_enable_crypto() Error in php mailer

查看:523
本文介绍了stream_socket_enable_crypto()错误在php邮件程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用PHP 5.3,我已经尝试发送邮件使用PHP邮件LIBRARY ..但我有错误

i have Used PHP 5.3 and i have tried to send mail using php mailer LIBRARY.. but i got Error


警告:stream_socket_enable_crypto ()[streams.crypto]:此流不支持D:\xampp\htdocs\mail_check\mail\class.smtp.php在线路上的SSL / crypto $ 313
邮件错误:SMTP连接()失败。

Warning: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto in D:\xampp\htdocs\mail_check\mail\class.smtp.php on line 313 Mailer Error: SMTP connect() failed.



$sendfrm_name = "xxxx";
        $sendfrm_id = "ddsdsd@gmail.com";

        $sendtoname = 'yyyy';
        $sendto = 'yyyyyy@gmail.com';

        $cc = '';

        include("mail/PHPMailerAutoload.php");
        include("mail/class.PHPMailer.php");
        include("mail/class.smtp.php");

        $mail = new PHPMailer;
        $mail-> isSMTP();
        $mail-> Host = 'smtp.gmail.com';
        $mail-> SMTPAuth = true;
        $mail->smtpConnect = array(
        'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
        )
        );
        $mail-> Username = 'fffffff@gmail.com';
        $mail-> Password = 'ekdbaffdfba..';
        $mail-> SMTPSecure = 'tls';
        $mail-> Port = 587; //587
        $mail-> setFrom($sendfrm_id, $sendfrm_name);
        $mail-> addAddress($sendto, $sendtoname);
        $mail-> addReplyTo($sendto, $sendtoname);
        //$mail->addCC($cc);
        $mail->WordWrap = 50;
        $mail->isHTML(true);
        $mail->Subject = "Test Mail";
        $mail->Body = "Name: ".$sendfrm_name ."<br /> Email: ".$sendfrm_id;
        if(!$mail->send())
        {
            echo "Mailer Error: ".$mail->ErrorInfo;
        }
        else
        {
            echo "1";
        }

我收到错误警告:stream_socket_enable_crypto()[streams .crypto]:此流不支持D:\xampp\htdocs\mail_check\mail\class.smtp.php第31行中的SSL / crypto
邮件错误:SMTP connect()失败。

如何解决此错误?

推荐答案

您的PHP安装缺少允许在这样的流上进行TLS加密的SSL扩展。还有类似的问题有答案,例如这一个

Your PHP installation is missing the SSL extension that allows TLS encryption on streams like this. There are similar questions that have answers to that, such as this one.

您不应该为PHP 5.3编写任何新代码 - 它不再受支持,可能有安全漏洞;更新可能会给你你所丢失的包装。

You should not be writing any new code for PHP 5.3 - it's no longer supported and may have security holes; updating may give you the wrappers you're missing anyway.

它不一定会影响这个特定的问题,但是你的代码基于一个过时的例子,没有加载PHPMailer类,因为文档告诉您 - 确保使用最新版本并将您的代码基于 PHPMailer提供的Gmail示例

It won't necessarily affect this particular issue, but you've based your code on an obsolete example, and are not loading the PHPMailer classes as the documentation tells you to - make sure you're using the latest version and base your code on the gmail example provided with PHPMailer.

这篇关于stream_socket_enable_crypto()错误在php邮件程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆