This article mainly introduces the Simple Mail sending class of the CI framework, and analyzes the function definition and usage of the Mail sending class in combination with the complete instance form, for more information, see the example in this article to describe the simple email sending class of the CI framework. We will share this with you for your reference. The details are as follows:
The ci framework is definitely what php beginners want. it can greatly shorten the amount of your code!
The following is a simple demonstration of my email sending:
Function email () {$ this-> load-> library ('email '); $ config ['protocol'] = 'smtp '; $ config ['smtp _ host'] = 'smtp .163.com '; $ config ['smtp _ user'] = 'jb51 @ 163.com '; // write your 163 email account $ config ['smtp _ pass'] = 'jb51; 'here ;'; // enter your 163 email password $ config ['mailtype'] = 'HTML '; $ config ['validate'] = true; $ config ['priority '] = 1; $ config ['crlf'] = "\ r \ n"; $ config ['smtp _ port'] = 25; $ config ['charset'] = 'utf-8'; $ config ['wordwre'] = TRUE; $ this-> email-> initialize ($ config ); $ this-> email-> from ('jb51 @ 163.com ', ''); // sender $ this-> email-> to ('2017 @ qq.com '); $ this-> email-> message ('Haha, test email send'); $ this-> email-> send (); echo $ this-> email-> print_debugger ();}
If you do not want to use the above method to set parameters, you can put them in a configuration file. Create a new file called email. php and add the $ config array to the file. Save the file as config/email. php and it will be used automatically. If you save a parameter configuration file, you do not need to use the $ this-> email-> initialize () function to initialize the parameter.