2014-12-24 15:40:59
来 源
中存储网
sendmail
在Windows下配置PHP中的sendmail图文教程分享:如果不用xampp的话,去下载个,如果用,刚按下面几步配置即可。1.使用sendmail 修改D:xamppsendmailsendmail.ini   具体内容是:[sendmail]smtp_server=mail

1.使用sendmail 修改 D:xamppsendmailsendmail.ini
php在windows配置下sendmail 详解 图解 完全攻略

php在windows配置下sendmail 详解 图解 完全攻略 具体内容是:

[sendmail]
smtp_server=mail.test.com
; smtp port (normally 25)
smtp_port=25
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify
default_domain=test.com
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging
error_logfile=error.log
; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging
debug_logfile=debug.log
; if your smtp server requires authentication, modify the following two lines
auth_username=info@test.com
auth_password=testpassword

配置以上几个参数即可
2.使用php sendmail修改 D:xamppapachebinphp.ini 修改如下:
php在windows配置下sendmail 详解 图解 完全攻略

具体内容如下:
[mail function]
; For Win32 only.
SMTP = mail.test.com
smtp_port = 25
; For Win32 only.
sendmail_from = info@test.com
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "D:xamppsendmailsendmail.exe -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

3. 重新启动 Apache,O定完!

4. 使用php sendmailymail()功能
php在windows配置下sendmail 详解 图解 完全攻略

$now = date('Y-m-d h:i:s');
$from_name = '测试寄件人';
$from_email = 'info@test.com';
$headers = "From: $from_name ";
$to = 'to@test.com';  //收件人邮件地址
$body = "嗨, n 这是一封测试邮件来自 $from_name .";
$subject = "[$now] 测试邮件发送";
if (mail($to, $subject, $body, $headers)) {
echo 'success!';
} else {
echo 'fail…';
}
?>
这样,Windows下使用php sendmail配置就顺利完成了!

执行完之后,再看D:xamppsendmail目录,会多出几个文件
php在windows配置下sendmail 详解 图解 完全攻略

php在windows配置下sendmail 详解 图解 完全攻略

具体一些内容大家试完自己看吧,error.log还是能有帮助的

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。