📜 ⬆️ ⬇️

Sending mail to CodeIgniter

It is known that when sending mail to CodeIgniter using the built-in email library, Russian letters in the headers may not be displayed correctly. Russian text in the message headers must be encoded manually. I implemented it like this:



$ this-> load-> library ('email');
$ this-> email-> reply_to ($ this-> input-> post ('email'), $ this -> _ mail_encode ($ this-> input-> post ('name'), "utf-8")) ;
$ this-> email-> from ($ this-> input-> post ('email'), $ this -> _ mail_encode ($ this-> input-> post ('name'), "utf-8")) ;
$ this-> email-> to ($ email);
$ this-> email-> subject ($ this -> _ mail_encode ("Message from the site test.ru", "utf-8"));
$ this-> email-> message ($ this-> input-> post ('message'));
$ this-> email-> send ();

')
The method contained in the controller is used:

function _mail_encode ($ text, $ encoding) {
$ result = "=?". $ encoding. "? b?". base64_encode ($ text). "? =";
return $ result;
}


More information about sending mail from scripts: http://habrahabr.ru/blog/webdev/32489.html

Source: https://habr.com/ru/post/27421/


All Articles