在Windows下配置PHP中的sendmail图文教程
思韵闪耀
2013-03-19
0
用sendmail来发批量邮件功能。
如果不用xampp的话,去下载个,如果用,刚按下面几步配置即可。
1.使用sendmail 修改 D:\xampp\sendmail\sendmail.ini



具体内容是:
[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:\xampp\apache\bin\php.ini 修改如下:


具体内容如下:
[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:\xampp\sendmail\sendmail.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,設定完畢!
4. 使用php sendmail測試mail()功能


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


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


【版权声明】
本站部分内容来源于互联网,本站不拥有所有权,不承担相关法律责任。如果发现本站有侵权的内容,欢迎发送邮件至masing@13sy.com 举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

相关内容

Windows serve...
Windows server2019安装Intel I219-V网...
2025-01-15
windows下安装Pre...
windows下安装PrestaShop报错Unable to g...
2024-06-16
Windows通过命令对文...
Windows通过命令对文件夹赋权要在Windows上使用命令行(...
2024-04-30
Windows计划任务出现...
最近遇见一个奇怪的现象,系统定时任务调用一个批处理,定时执行错误,...
2024-03-25
Windows使用vlmc...
lmcsd就是一个仿真KMS管理工具,可以部署在内网或者公网可以运...
2023-12-02
windows Serve...
Windows 评估版(Evaluation)到期后会自动关机,要...
2023-12-02

热门资讯

Discus X论坛配置sen... Discuz x2.5 后台邮件设置方法其实和X2/x1.5基本一样,但很多同学都不注意一些细节,比...
redhat Linux系统配... 1 .检查Send Mail 的安装包 [root@sql root]# rpm -qa | gre...
使用Sendmail的反垃圾邮... 在最近几年,无处不在的垃圾邮件已使得所有邮件箱不堪重负,不断地需要工具以抗击这一无穷尽的垃圾邮件流。...