我更改了php.ini
和sendmail.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;但不发送电子邮件。请建议。