Skip to content

Instantly share code, notes, and snippets.

@takekoshi
Created October 11, 2013 09:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takekoshi/6931872 to your computer and use it in GitHub Desktop.
Save takekoshi/6931872 to your computer and use it in GitHub Desktop.
codeigniter2.0.3日本語版: application/libraries/MY_Email.phpの例
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Email extends CI_Email {
public function __construct($config = array())
{
parent::__construct($config);
}
public function message($body)
{
if (strtolower($this->charset) == 'iso-2022-jp') {
$this->_body = rtrim(str_replace("\r", "", $body));
} else {
$this->_body = stripslashes(rtrim(str_replace("\r", "", $body)));
}
$CI =& get_instance();
$this->_body = mb_convert_encoding($this->_body, $this->charset, $CI->config->config['charset']);
return $this;
}
public function subject($subject)
{
$CI =& get_instance();
mb_internal_encoding($this->charset);
$subject = mb_encode_mimeheader(mb_convert_encoding($subject, $this->charset, $CI->config->config['charset']), $this->charset, 'B', $this->crlf);
mb_internal_encoding($CI->config->config['charset']);
$this->_set_header('Subject', $subject);
return $this;
}
private function _set_header($header, $value)
{
$this->_headers[$header] = $value;
}
}
// END MY_Email class
/* End of file MY_Email.php */
/* Location: ./application/libraries/MY_Email.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment