在windows下调试php的mail()简直是场噩梦,使用起来极为不便。

要使用mail()必须搭建smtp服务器,测试大都是在local上进行的,搭建过程繁琐,折腾了1个晚上后,下面的提示仍然恶心的告诉我还没是不成!

mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in XXXXXXXXXXXX

不必要在一条路上碰壁而亡,跳出圈外找个简约但是不简单的发mail的类吧。

这个就是找到的一个小东东了,phpmailer:https://github.com/Synchro/PHPMailer

可以直接打包下载,测试好用。大家可以在windows和linux下直接调用,而无需去搭建啥smtp和谨小慎微的关注n个配置文件了。

下面是phpmailer的下载附件:

PHPMailer-master

PHPMailer-phpmailer-5.2.0

我搭建的环境是php 5.2.6,使用PHPmailer 5.2.0好用!而 phpmailer-master则报错,不同环境的朋友可挑选适合自己的版本。

使用方法和注意事项,我会在后面的时间贴出来滴。

 

yantaisolo

作者 yantaisolo

在 “mail函数当放下,推荐php下的mail神器:phpmailer” 有 1 条评论

评论已关闭。