$ This-& gt; load-& gt; library (& amp; #39; email & amp; #39;); $ config [& amp; #39; protocol & amp; #39;] & amp; #39; smtp & amp; #39; // send it to QQ users for Chinese use & amp; #39; ISO-8859-1 & amp; #39; $ c
$ This-> load-> library ('email ');
$ 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 ...';
}