public function response()
 {
     $error_code = $this->getMessage();
     $error_list = Lang::load('error/user', $error_code);
     if (!isset($error_list[$error_code])) {
         $error_code = \Model_Error::ER00001;
     }
     $error_message = $error_list[$error_code];
     $params = array('error_code' => $error_code, 'error_message' => $error_message, 'line' => $this->getLine(), 'file' => $this->getFile(), 'url' => Uri::main(), 'input' => print_r(Input::all(), true), 'real_ip' => Input::real_ip(), 'user_agent' => Input::user_agent(), 'user_id' => Auth::get_user_id(), 'occurred_at' => date('Y/m/d H:i:s'));
     $email = new Model_Email();
     $email->sendMailByParams('error', $params);
     $response = \Request::forge('errors/index', false)->execute($params)->response();
     return $response;
 }
 /**
  * ユーザーにメールを送信
  *
  * @access private
  * @param array
  * @return bool
  */
 private function sendMailToUser($args)
 {
     $email = new \Model_Email();
     $params = array();
     foreach ($args as $key => $value) {
         foreach (array_keys($value->properties()) as $column) {
             $params["{$key}.{$column}"] = $value->get($column);
         }
     }
     $entry = $args['entry'];
     $entry_styles = \Config::get('master.entry_styles');
     $params['fleamarket_entry_style.entry_style_name'] = $entry_styles[$entry->fleamarket_entry_style->entry_style_id];
     $params['fleamarket_entry_styles.entry_style_name'] = implode('/', array_map(function ($obj) use($entry_styles) {
         return $entry_styles[$obj->entry_style_id];
     }, $entry->fleamarket->fleamarket_entry_styles));
     try {
         $email->sendMailByParams('send_mail_to_user_waiting_reservation', $params, $args['entry']->user->email);
     } catch (\Exception $e) {
         return false;
     }
     return true;
 }
 /**
  * ユーザーにメールを送信
  *
  * @para $contact Model_Contact
  * @access private
  * @return void
  */
 private function sendMailToUserAndAdmin($contact)
 {
     $params = array();
     foreach (array('contact_id', 'last_name', 'first_name', 'subject', 'email', 'tel', 'contents') as $key) {
         $params[$key] = $contact->get($key);
     }
     $params['inquiry_type_label'] = $contact->inquiry_type_label();
     $email = new Model_Email();
     $email->sendMailByParams("inquiry/user", $params, array($contact->email));
     $email->sendMailByParams("inquiry/admin", $params, '', array('reply_to' => $contact->email));
 }
 /**
  * ユーザにテンプレートのメールを送信します
  * lang/ja/email配下のテンプレートを利用します。
  *
  * @access public
  * @param string $subject
  * @param string $body
  * @return bool
  * @author shimma
  *
  * @todo 日本語のエラー表示を正しいものに変換する
  */
 public function sendmail($template_name, $params = array())
 {
     try {
         $email = new \Model_Email();
         $email->sendMailByParams($template_name, $params, $this->email);
     } catch (\Exception $e) {
         throw new \SystemException(\Model_Error::ER00303);
     }
 }