Home > Backend Development > PHP Tutorial > Explanation of sending emails using Zend_Mail in Zend Framework_PHP Tutorial

Explanation of sending emails using Zend_Mail in Zend Framework_PHP Tutorial

WBOY
Release: 2016-07-13 17:42:33
Original
838 people have browsed it

Everyone knows that Zend Framework is a standard PHP5 version of the framework developed by zend Company. It includes almost the functional modules we often use, such as feed, mail, cache, db, etc. Today we will mainly introduce it. The Zend_Mail module helps us send application information to administrators and customers in a timely manner.

The following is a code block I wrote. This code is to send emails through SMTP. You need to provide a username, password and host address. This is also the email login method we often use.

require_once Zend/Mail.php;
require_once Zend/Mail/Transport/Smtp.php;
class logMail {
private static $_config=array(auth=>login,
username=>XXXX@yuyu.com,
password=>XXXX);
private static $_mail = null;
private static $_transport = null;
public function __construct($ title, $body){
                                                                                                                                                yuyu.com,self::$_config);
                                                                                   new Zend_Mail();
$mail->setBodyText($body);
$mail->setFrom(XXX@yuyu.com, XXX);
                 $mail->addTo(XXX@ 163.com, XXX);
$mail->setSubject($title.(.$shijie.));
$mail->send($transport);                     return true;
                  }catch(Exception $e)                                                                                                   }
                                                                                return false; title, $body) {
                                                                                                        using  new logMail(Test,Test);

Through the above code, you only need to change the username and password to your own, and you can use them in the application at will. There may be more important applications. It’s the sending of logs and the sending of projects!





http://www.bkjia.com/PHPjc/486061.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/486061.html

TechArticle
Everyone knows that Zend Framework is a standard PHP5 version of the framework developed by zend Company. It includes Almost the functional modules we often use, such as feed, mail, cache, db, etc.,...

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template