How to send e-mail using thinphp _php tutorial

Source: Internet
Author: User

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.