警告:mail()[function.mail]:无法连接到" localhost"的邮件服务器端口25,验证您的" SMTP"和" smtp_port"

时间:2018-01-30 18:58:54

标签: php mysql wamp

我编写此代码用于通过电子邮件收集信息,此处我使用sendmail插件,但此处生成错误,无法连接到邮件服务器error

我对php.ini进行了一些修改

SMTP = localhost
smtp_port = 25
sendmail_path ="C:\wamp\sendmail\sendmail.exe -t -i";

 <?php
    $to = 'localhost,wasu3690@gmail.com';
    $subject = 'My subject';
    $txt = 'Hello world!';
    $headers = 'From: wasu3690@gmail.com';

     if (mail($to,$subject,$txt,$headers))
            echo "Email Sent";
            else "not sent";
    ini_set("SMTP",'localhost');
    ini_set("smtp_port",25);

    ?>

0 个答案:

没有答案