Windows下面配置sendmail邮件服务器

50 篇文章 0 订阅

这两天搞邮件服务器,头大了,不过还是被我搞出来了,初接触,完全靠自己摸索,现在把经验整理一次,供其他同学学习,多多交流。

1、apache服务器里面使用

win10下面WAMP集成环境:
Apache/2.4.18 (Win64) PHP/5.6.19 Server at localhost Port 80

php mail()函数在windows不能用,需要安装sendmail ;
1.从http://download.csdn.net/detail/zhezhebie/9761174下载sendmail.zip
2.解压到wamp任意目录下,例如D:\wamp64\sendmail,最好短路径,长路径名有可能产生问题。 以供php和apache调用。
3.配置sendmail.ini,配置文件就在刚刚解压的那个目录里面,我的目录如下:

D:\wamp64\sendmail\sendmail.ini

需要修改的地方:

smtp_server=smtp.exmail.qq.com          //这里写发送邮件的邮件服务器
smtp_port=25            //发送邮件服务器端口,默认25,一般不需要修改
error_logfile=error.log
debug_logfile=debug.log
这两个是错误调式,一开始建议打开;
auth_username=SHUIPING_YANG@laoda.com       //邮箱名称
auth_password=kuaikuaichengzhang            //邮箱密码
force_sender=SHUIPING_YANG@laoda.com

到这里,sendmail.ini就配置好了

4.配置D:\wamp64\bin\php\php5.6.19\phpForApache.ini

[mail function] 
; For Win32 only. 
SMTP = smtp.exmail.qq.com 
smtp_port = 25 
; For Win32 only. 
sendmail_from = SHUIPING_YANG@laoda.com 
; For Unix only. You may supply arguments as well (default: “sendmail -t -i”). 
sendmail_path = “D:\wamp64\sendmail\sendmail.exe -t -i -f” 

就配置四项,smtp、smtp_port 、sendmail_from和sendmail_path

好了,这就可以了,
以下是php代码:

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('1037547965@qq.com', 'My Subject', $message);

看看,已经发送成功了!大功告成!右键》在此新窗口中打开,可以看到大图:
发送成功

2、nginx服务器里面使用

下面发一个使用nginx服务器的时候配置sendmail服务器:
需要配置php.ini里面的关于Mail配置那一段;
配置一下sendmail.ini,方法同apache的基本一样。

  • 2
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SHUIPING_YANG

你的鼓励是我创作的最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值