我无法让 PHP 邮件发送电子邮件...
所有这些只是为了在我的本地主机设置中测试我的 php 邮件功能。XAMPP-apache,mercury,mysql,windowXP
我很确定我正确安装了mercury 32,如果我用它向root@localhost.com 发送电子邮件,它工作正常,我看到它已发送,并在我的雷鸟收件箱中进行了设置。
php.ini 是我有点困惑的地方
[mail function]
;---- I left this as is(out), since I AM using Mercury
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
;---- I created a root user in mercury
sendmail_from = root@localhost
; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesD:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.
; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
;sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"
; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the D:\xampp\mailoutput folder
;---- I left this as is(in), but I feel it should be commented out, but if I take out i get error in pho mail() code
sendmail_path = "D:\xampp\mailtodisk\mailtodisk.exe"
邮件()的PHP代码;
.....
$mailSubject = "Hello there!!!";
$mailFrom = "From: me123@gamil.com" . "\r\n";
$mailTo = "root@localhost.com";
if (mail($mailTo, $mailSubject, $mailMessage, $mailFrom)){
echo("Message successfully sent! $mailTo");
}
else {
echo("Message delivery failed...");
}
邮件被发送,但发送到哪里?我永远找不到它
一些图片:
测试 Mercury。转到“文件>发送邮件”以获取此屏幕并创建一封电子邮件进行测试
客户电子邮件收件箱-上述图像/测试的结果
浏览器中的脚本输出