How to send e-mail using thinphp
For a long time did not move PHP, suddenly want to send e-mail with thinkphp, but read the books are very messy, did not continue to see, here found a better way:
First step: First we will introduce an external class library: Mail.class.php
Put it in the Org directory (that is, thinkphp's core directory that piece, if not understood, see):
In this way, we have introduced the relevant class library. The download address for the class library is as follows: Mail.class.php
Step Two:
In the common/conf/config.php file, add the following configuration information (do not copy, the following is your own mailbox information):
Configure information about a mailbox
' mail_address ' = ' 18753377393@163.com ',//email address
' Mail_smtp ' = ' smtp.163.com ',//mailbox SMTP Server
' Mail_loginname ' = ' 18753377393 ',//Email login account
' Mail_password ' = ' 123456789 ',//email password
' Mail_charset ' = ' UTF-8 ',//coded
' Mail_auth ' =>true,//email authentication
' mail_html ' =>true,//true HTML format false txt format
At this point, the configuration of the mailbox function has been completed. The next is sent:
Step three: Send mail:
Within the specific controller method:
Import ('. ORG. Mail ');//introduction of the Message class
SendMail (' Destination address ', ' mail header ', ' body ', ' sender '); The target address is the email address you want to send to that person.
When you're done, the final thing is to see if the recipient's mailbox has received the email and the message is formatted correctly.
http://www.bkjia.com/PHPjc/1023579.html www.bkjia.com true http://www.bkjia.com/PHPjc/1023579.html techarticle the method of sending e-mail with thinphp for a long time did not move PHP, suddenly want to send e-mail with thinkphp, but read the books are written very messy, did not continue to see, here to find ...