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