php.ini
和sendmail.ini
的配置如下:
[mail function]
sendmail_path = ""'"E:'Installed_Apps'xampp'sendmail'sendmail.exe'" -t""
mail.add_x_header = Off
[sendmail]
SMTP = localhost
smtp_port = 25
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
auth_username=my_gmail_address
auth_password=my_xxxxxx
pop3_server=
pop3_username=
pop3_password=
force_recipient=
hostname=
我试着发送电子邮件:
<?php
$sent = mail('to_someone@hotmail.com','Message sent from XAMPP','Hey ! I just sent you a message using XAMPP');
if($sent) {
echo "Mail sent successfully";
}else {
echo "Sending failed";
}
我总是为$sent
获得true
,但没有收到上述地址的电子邮件。这可能是什么原因呢?配置文件有什么问题吗?
注意:我上传了php.ini
和sendmail.ini
@ github,我在25上运行水星
您正在积极地设置它使用mailtodisk.exe
,这是一个程序,只是采取电子邮件,并将其保存到一个文件夹-它从来没有试图发送电子邮件,它只是一个工具,检查您的电子邮件看起来正确。
关于sendmail_path
的文档:
设置后,smtp、smtp_port和sendmail_from将被忽略执行指定命令
尝试注释sendmail_path
并检查您的计算机上有一个SMTP服务器在端口25上运行