CodeIgniterへのメールの送信

組み込みの電子メールライブラリを使用してCodeIgniterにメールを送信すると、ヘッダー内のロシア語の文字が正しく表示されない場合があることが知られています。 メッセージヘッダーのロシア語のテキストは、手動でエンコードする必要があります。 このように実装しています:







$ 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(“ test.ruからのメッセージ”、“ utf-8”));

$ this-> email-> message($ this-> input-> post( 'message'));

$ this-> email-> send();




コントローラーに含まれるメソッドが使用されます。



function _mail_encode($テキスト、$エンコード){

$ result = "=?"。$ encoding。 "?b?"。base64_encode($ text)。 "?=";

return $ result;

}




スクリプトからのメール送信に関する詳細: http : //habrahabr.ru/blog/webdev/32489.html



All Articles