45IT.COM- 电脑学习从此开始!
DIY硬件教程攒机经验装机配置
设计Photoshop网页设计特效
系统注册表DOS系统命令其它
存储主板显卡外设键鼠内存
维修显卡CPU内存打印机
WinXPVistaWin7unix/linux
CPU光驱电源/散热显示器其它
修技主板硬盘键鼠显示器光驱
办公ExcelWordPowerPointWPS
编程数据库CSS脚本PHP
网络局域网QQ服务器
软件网络系统图像安全
页面导航: 首页 > 电脑学院 > 服务器技术 >

iis下php mail函数的sendmail配置方法

电脑软硬件应用网 45IT.COM 时间:2012-04-22 23:25 作者:佚名

很多玩discuz的盆友在使用在线发邮件的功能,但是测试了"通过 PHP 函数的 sendmail 发送(推荐此方式)"怎么都没用,因为本人现在用的是iis+php环境,所以就出这么一个教程,教大家在自己服务器上配置sendmail

首先你需要先到从http://glob.com.au/sendmail/下载sendmail.zip文件,然后把它解压到如D:\php\sendmail\目录下。

然后打开php.ini文件,找到下面这段代码


  1. [mail function]  
  2. ; For Win32 only.  
  3. SMTP = localhost  
  4. smtp_port = 25  
  5. ; For Win32 only.  
  6. ;sendmail_from = me@example.com  
  7. ; For Unix only.  You may supply arguments as well (default: ”sendmail -t -i”).  
  8. ; sendmail_path = ”"  
  9. ; Force the addition of the specified parameters to be passed as extra parameters  
  10. ; to the sendmail binary. These parameters will always replace the value of  
  11. ; the 5th parameter to mail(), even in safe mode.  
  12. ;mail.force_extra_parameters = 

 默认情况下是以本机做为邮件服务器,这里我们需要借用sendmail来发送邮件,用sendmail来配置如用qq、163的邮箱来发送(一般都是以这种方式)所以我们需要把所有的选项都注销,即把SMTP = localhost和smtp_port = 25前面加上“;”然后把sendmai_path=""前面的“;”删掉,改为sendmai_path="d:\php\sendmail\sendmail.exe -t",改完后的即是


  1. [mail function]  
  2. ; For Win32 only.  
  3. ;SMTP = localhost  
  4. ;smtp_port = 25  
  5. ; For Win32 only.  
  6. ;sendmail_from = me@example.com  
  7. ; For Unix only.  You may supply arguments as well (default: ”sendmail -t -i”).  
  8. sendmail_path = ”d:\php\sendmail\sendmail.exe -t"  
  9. ; Force the addition of the specified parameters to be passed as extra parameters  
  10. ; to the sendmail binary. These parameters will always replace the value of  
  11. ; the 5th parameter to mail(), even in safe mode.  
  12. ;mail.force_extra_parameters = 

注意以上只需要开启sendmail_path即可,然后保存

 接着修改sendmail目录下的sendmail.ini文件,主要填的内容有以下几项


  1. smtp_server=smtp服务器地址(如 smtp.ym.163.com)  
  2. auth_username=邮箱登录名(如 info@xxxx.com)  
  3. auth_password=邮箱密码(如 xxxxxx)  
  4. force_sender=发件人地址全写(如 info@xxxx.com) 

另外还有一项


  1. ;   auto = use SSL for port 465, otherwise try to use TLS 

把前面的“;”删除,即开启SSL安全登录选项即可

以上四项正确填写修改完成后保存,然后重启IIS即可正常使用。

顶一下
(1)
100%
踩一下
(0)
0%
------分隔线----------------------------
无法在这个位置找到: baidushare.htm
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
验证码:点击我更换图片
推荐知识