你还在使用PHPMailer吗?out了吧!
mailpp是用C++写成的一个PHP扩展,专门用来执行发送邮件的任务。
class mailpp { public function __construct(); public function set_host_port($host,$port) ; public function set_user_password($user,$password); public function set_content_type($content_type); public function set_subject($subject); public function set_from($from,$fromname); //totype:{PRIMARY,CC,BCC} public function set_to($to,$totype,$toname); public function set_body($body); public function send(); public function send_by_tls(); public function send_by_ssl(); }
接口一目了然。
用法很简单:$mailpp = new mailpp();$mailpp->set_host_port($__config__["email"]["smtp"], $__config__["email"]["port"]);$mailpp->set_user_password($__config__["email"]["user"], $__config__["email"]["password"]);$mailpp->set_content_type("HTML");$mailpp->set_from($__config__["email"]["from"], $__config__["email"]["name"]);$mailpp->set_to("****@qq.com", "BCC", "QQ1");$mailpp->set_to("****@163.com", "BCC", "163");$mailpp->set_to("****@qq.com", "CC", "QQ2");$mailpp->set_to("****@gmail.com", "PRIMARY", "GMAIL");$mailpp->set_subject("抄送,密送功能");$mailpp->set_body("<html><head></head><body><p>mailpp发邮件!</p></body></html>");$ok = $mailpp->send_by_ssl();
mailpp提供三种发送方法:send,send_by_ssl,和send_by_tls。可根据具体配置自行选择。
下载地址:http://www.wqbuyer.com/demo/blog/3.html.