无法从localhost

时间:2018-06-09 20:01:58

标签: php sendmail

我更改了php.inisendmail.ini,如下所示:

[php.ini中]

extension=php_openssl.dll
[mail function]
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = [mymail]@gmail.com
sendmail_path = "\"E:\xampp\sendmail\sendmail.exe" -t"

[sendmail.ini]

smtp_server= smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username= [mymail]@gmail.com
auth_password= [mymailpassword]
pop3_server=
pop3_username=
pop3_password=
force_sender=[mymail]@gmail.com
force_recipient=
hostname=localhost

html代码

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <form method="post">
        <input type="email" name="email"> 
        <input type="submit" name="submit">
    </form>
</body>
</html>

php代码

if (isset($_POST['submit'])) {
    if (mail($_POST['email'], 'subject', 'Message')) {
        echo 'Success';
    } else {
        echo 'Failed';
    }
}

当我点击提交按钮时,它会显示消息&#34;成功&#34;但不发送电子邮件。请建议。

0 个答案:

没有答案