Generally, the email address is encoded in gb2312, gbk, big5, and ansi. you can convert UTF-8 to gb2312functionsendmail () {$ config = Array (
Generally, email addresses are encoded in gb2312, gbk, big5, and ansi formats. you can convert UTF-8 to gb2312.
Function sendmail () {$ config = Array ('protocol' => 'smtp ', 'smtp _ host' => 'Mail .cmcc.cn', 'smtp _ port' => 25, 'smtp _ user' => 'lichao', 'smtp _ pass' => '000000', 'charset' => 'gb2312 ', 'mailtype' => 'html',); // SSL method // $ config_ssl = Array (// 'protocol' => 'smtp ', // 'smtp _ host' => 'SSL: // smtp.gmail.com ', // 'smtp _ port' => '123 ', // 'smtp _ user' => '1970 @ gmail.com ', // 'smtp _ pass' => '20140901', // 'mailtype' => 'html ', //); $ this-> load-> library ('email ', $ config); $ this-> email-> set_newline ("rn "); $ from_name = "Xiao Li"; // sender name $ email_subject = "call ticket"; $ email_msg ="
Hello! Please check it out! "; // Solve the garbled problem $ from_name = iconv ('utf-8', 'gb2312 ', $ from_name); $ email_subject = iconv ('utf-8 ', 'gb2312', $ email_subject); $ email_msg = iconv ('utf-8', 'gb2312 ', $ email_msg ); // encapsulate the sending information $ this-> email-> from ('lichao @ chinamobile.com ', $ from_name); $ this-> email-> to ('lichao @ chinamobile.com '); $ this-> email-> subject ($ email_subject); $ this-> email-> message ($ email_msg); $ this-> email-> attach ("attachments/2009/01/1. xls "); // Attachment // send if (! $ This-> email-> send () {show_error ($ this-> email-> print_debugger (); return false;} else {echo "sent successfully! "; Return true ;}}