Code snippets for symfony 1.x

Navigation

Refine Tags

Snippets tagged "japanese"

How to use sfMail to encode body of Japanese Email.

How to use sfMail to encode Body of Japanese Email.

The Japanese Email usually use ISO-2022-JP. But, I want to use UTF-8 of any Email template files. For example...

I create PROJECT_DIR/lib/myMail.class.php

myMail.class.php

<?php
 
class myMail extends sfMail
{
  public function setBody ($body)
  {
    parent::setBody(mb_convert_encoding($body, "JIS", "UTF-8"));
  }
}
 
?>

OK, Use this class from your Action.

actions.class.php

  public function executeSendmail()
  {
    $mail = new myMail();
    ....
  }
by Kota Sakoda on 2007-02-13, tagged email  encode  iso2022jp  japanese  sfmail  utf8