警告:mail()[function.mail]:无法连接到“localhost”端口465的邮件服务器,

时间:2014-06-10 10:24:21

标签: php mysql

我已经配置了wamp服务器,并且已经对相关文件进行了更改,但我一次又一次地遇到错误,所以请帮助我克服它.....因为它太忙了.....

这是我的mail()函数代码

 <?php
   if(mail('vipinkumarsn4@gmail.com','Hello', 'hello', 'noreply@gmail.com'))
        echo "Email sent";
    else
        echo "Email sending failed";
    ?>

这是我的sendmail.ini文件

         [sendmail]
     smtp_server=smtp.gmail.com

        ; smtp port (normally 25)

        smtp_port=465

        ; SMTPS (SSL) support
        ;   auto = use SSL for port 465, otherwise try to use TLS
        ;   ssl  = alway use SSL
        ;   tls  = always use TLS
        ;   none = never try to use SSL

        smtp_ssl=ssl

php.ini文件

[mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 465

    ; For Win32 only.
    sendmail_from = vipin.cybomate@gmail.com

1 个答案:

答案 0 :(得分:1)

您必须激活SSL chanel。使用'自动'协议

    ; SMTPS (SSL) support
    ;   auto = use SSL for port 465, otherwise try to use TLS
    ;   ssl  = alway use SSL
    ;   tls  = always use TLS
    ;   none = never try to use SSL

    smtp_sll = auto;  // otherwise try to use TLS