CodeIgniter sending email (smtp) _ PHP Tutorial

Source: Internet
Author: User
CodeIgniter sends an email (smtp ). $ This-load-library (email); $ config [protocol] smtp; send to QQ user to display Chinese with ISO-8859-1 $ config [charset] ISO-8859-1; send to 163 user, gb2 $ this-> load-> library ('email ') to display Chinese characters ');


$ Config ['protocol'] = 'smtp ';
// Send it to the QQ user and use 'ISO-8859-1 'to display Chinese characters'
$ Config ['charset'] = 'ISO-8859-1 ';
// Send the message to 163 users. use 'gb2312' to display Chinese characters'
// $ Config ['charset'] = 'gb2312 ';
$ Config ['mailpath'] = 'news/index ';
$ Config ['smtp _ host'] = 'smtp .163.com ';
$ Config ['smtp _ user'] = 'example0624 @ 163.com ';
$ Config ['smtp _ pass'] = 'password ';

$ This-> email-> initialize ($ config );

$ This-> email-> from ('example0624 @ 163.com ', 'example ');
$ This-> email-> to ('tosombody @ qq.com ');
// Set CC to www.2cto.com
// $ This-> email-> cc ();
// Set to send messages in the dark
// $ This-> email-> bcc ();
$ This-> email-> subject ("The test of CodeIgniter's sending mail ");
$ This-> email-> message ('Hi, this is my test program. Do not reply to emails sent successfully through CodeIgniter. ');
// The path must use an absolute path.
$ This-> email-> attach ('d:/QCallServer/htdocs/CI/public/images/google.jpg ');
If ($ this-> email-> send ()){

Echo 'success ...';
} Else {
Echo 'failed ...';
}

Login (email); $ config [protocol] = smtp; // send to QQ user, to display Chinese with ISO-8859-1 $ config [charset] = ISO-8859-1; // send to 163 user, gb2...

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.