Public function sendMail (){
$ Config ['protocol'] = 'smtp '; // use smtp
$ Config ['smtp _ host'] = 'smtp .126.com ';
$ Config ['smtp _ user'] = 'mytest @ 126.com '; // your email account
$ Config ['smtp _ pass'] = 'mytest123'; // your email password
// $ Config ['smtp _ pass'] = 25;
$ Config ['charset'] = 'utf-8 ';
$ Config ['wordwre'] = TRUE;
$ Config ['mailtype'] = "html ";
$ This-> load-> library ('email '); // load the email class
$ This-> email-> initialize ($ config); // parameter configuration
$ This-> email-> from ('lijun%19862008 @ 126.com ', 'am the sender Chen Liwei ');
$ This-> email-> to ('My @ test.com ');
// $ This-> email-> cc ('another @ another-example.com ');
// $ This-> email-> bcc ('them @ their-example.com ');
$ This-> email-> subject ('email Test to guijia ');
$ This-> email-> message ('testing the email class .');
$ This-> email-> attach ('static/upfile/'. $ sfile .'');
// Display the email sending result and load it to the res_view.php View File.
If (! $ This-> email-> send ()){
$ Data = "<font color = 'red' size = '10px '> email sending failed, possibly because your sender or password does not match </font> ";
} Else {
$ Data = "<font color = 'red' size = '10px '> email sent successfully </font> ";
}
Echo $ data;
Echo $ this-> email-> print_debugger ();
}