[英]apache, mercury32, php mail. Can't get it to work
我无法获得PHP邮件来发送电子邮件...
所有这些只是为了在我的本地主机设置中测试我的php邮件功能。 XAMPP-apache,汞,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"
mail()的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...");
}
邮件被发送了,但是到哪里呢? 我永远找不到
一些图像: 测试水星。 转到“文件>发送邮件”以获取此屏幕,并创建了一封电子邮件进行测试
客户电子邮件收件箱-以上图片/测试的结果
浏览器中的脚本输出
(第一:对不起我的英语不好)要解决此问题,我将php.ini和sendmail.ini配置如下:
php.ini:
[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = 127.0.0.1
smtp_port = 25
sendmail_from = postmaster@localhost
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\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 = "\"C:\xampp\sendmail\sendmail.exe\" -t"
;sendmail_path = "C:\xampp\sendmail\sendmail.exe\ -t"
; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
还有sendmail.ini
[sendmail]
; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.
;smtp_server=mail.mydomain.com
smtp_server=localhost
记得在PHP.ini上评论sendmail_path,现在对我有用:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.