ZF框架实现发送邮件的方法_PHP

WBOY
Release: 2016-05-29 11:47:54
Original
941 people have browsed it

本文实例讲述了ZF框架实现发送邮件的方法。分享给大家供大家参考,具体如下:

Zend_Loader::loadFile("Zend/Mail.php"); Zend_Loader::loadFile("Zend/Mail/Transport/Smtp.php"); $config = array( 'auth' => 'login', 'username' => 'username@163.com', 'password' => 'password', ); $transport = new Zend_Mail_Transport_Smtp('smtp.163.com', $config); $mail = new Zend_Mail(); $mail->setBodyText("this is body text", "utf-8"); $mail->setFrom("username@163.com", "loopercopper"); $mail->addTo('wiseideal@163.com', "andy"); $mail->setSubject("testSubject"); $mail->send($transport);
Copy after login

解决主题乱码的方式:

代码如下:

$mail->setSubject("=?UTF-8?B?".base64_encode("中文消息")."?=");

希望本文所述对大家基于zend framework框架的PHP程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!