function mailDefault($template, $to, $data)
 {
     $arrayMail = array();
     $file = file($template);
     //Get values from template mail
     foreach ($file as $value) {
         if ($value != "") {
             list($key, $val) = explode("=>", $value);
             $key = trim($key);
             $val = trim($val);
             $arrayMail[$key] = $val;
         }
     }
     $subject = $arrayMail['subject'];
     $from = $arrayMail['from'];
     $body = $arrayMail['body'];
     $body = str_replace('\\r\\n', "\n", $body);
     //			$headers .= "MIME-Version: 1.0\r\n";
     //			$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
     //			$headers  .= "From: $from\r\n";
     //push value from in parameter to body mail
     foreach ($data as $key => $item) {
         $body = str_replace('{$' . $key . '}', $item, $body);
     }
     //Execute send mail
     mb_language("Japanese");
     mb_internal_encoding("UTF-8");
     if (mb_send_mail($to, $subject, $body, "From: " . $from)) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
 /**
  * メール送信処理
  */
 private function sendMail()
 {
     //メールを送信する処理
     //    $mailer = jpSimpleMail::create('SwiftMailer4'); // このサンプルではSwift Mailerを利用しています。
     //    $mailer->setSubject('メール送信テストです');
     //    $mailer->setSender('*****@*****.**');
     //    $mailer->addTo(sprintf('%s <%s>', '宛先 太郎', '*****@*****.**'));
     //    $mailer->setFrom(sprintf('%s <%s>', '管理者', '*****@*****.**'));
     //    $mailer->setBody('本文です');
     ////    var_dump($mailer->getFrom());
     //    try{
     //    	$rs = $mailer->send();
     //    }catch(jpSendMailException $e){
     //    	echo 'exception';
     //    }
     //
     //    var_dump($rs);
     mb_language('ja');
     mb_internal_encoding('UTF-8');
     $to = sfConfig::get('sf_iquiry_mail');
     //宛先
     $subject = "お問い合わせ";
     //題名
     $body = $this->getRequestParameter('message');
     //本文
     $from = sfConfig::get('sf_iquiry_mail');
     //差出人
     //これでは文字化け!
     mail($to, $subject, $body, "From:" . $from);
 }
 public static function mail_to($value, $mails)
 {
     //return md5($value);
     mb_language("japanese");
     mb_internal_encoding("utf-8");
     $email = mb_encode_mimeheader("チラシシステム") . "<*****@*****.**>";
     $subject = $value["title"];
     $body = $value["text"];
     //$from = "lightbox@sdc";
     //ini_set( "SMTP", "localhost" );
     //ini_set( "smtp_port", 25 );
     //ini_set( "sendmail_from", $from );
     $bccs = implode(' ,', $mails);
     $header = "From: " . mb_encode_mimeheader("チラシシステム") . "<*****@*****.**>";
     $header .= "\n";
     $header = "Bcc:" . $bccs;
     //$header ="Bcc:zuo@it-art.jp,zou@shift-jp.net";
     $header .= "\n";
     if (!@mb_send_mail(NULL, $subject, $body, $header)) {
         // echo "*********mb_send_mailエラー**************";
         return false;
     } else {
         //echo "*********sucess**************";
         return true;
     }
 }
 public function initialize()
 {
     $this->setMailer(new PHPMailer());
     mb_language('Ja');
     $this->setCharset('iso-2022-jp');
     $this->setEncoding('7bit');
 }
Ejemplo n.º 5
0
 static function initMbstring()
 {
     if (extension_loaded('mbstring')) {
         if (((int) ini_get('mbstring.encoding_translation') || in_array(strtolower(ini_get('mbstring.encoding_translation')), array('on', 'yes', 'true'))) && !in_array(strtolower(ini_get('mbstring.http_input')), array('pass', '8bit', 'utf-8'))) {
             user_error('php.ini settings: Please disable mbstring.encoding_translation or set mbstring.http_input to "pass"', E_USER_WARNING);
         }
         if (MB_OVERLOAD_STRING & (int) ini_get('mbstring.func_overload')) {
             user_error('php.ini settings: Please disable mbstring.func_overload', E_USER_WARNING);
         }
         mb_regex_encoding('UTF-8');
         ini_set('mbstring.script_encoding', 'pass');
         if ('utf-8' !== strtolower(mb_internal_encoding())) {
             mb_internal_encoding('UTF-8');
             ini_set('mbstring.internal_encoding', 'UTF-8');
         }
         if ('none' !== strtolower(mb_substitute_character())) {
             mb_substitute_character('none');
             ini_set('mbstring.substitute_character', 'none');
         }
         if (!in_array(strtolower(mb_http_output()), array('pass', '8bit'))) {
             mb_http_output('pass');
             ini_set('mbstring.http_output', 'pass');
         }
         if (!in_array(strtolower(mb_language()), array('uni', 'neutral'))) {
             mb_language('uni');
             ini_set('mbstring.language', 'uni');
         }
     } else {
         if (!defined('MB_OVERLOAD_MAIL')) {
             extension_loaded('iconv') or static::initIconv();
             require __DIR__ . '/Bootup/mbstring.php';
         }
     }
 }
Ejemplo n.º 6
0
 public function noticePackageUploaded(Package $pkg)
 {
     $app = $this->app;
     $package_url = mfwRequest::makeURL("/package?id={$pkg->getId()}");
     ob_start();
     include APP_ROOT . '/data/notice_mail_template.php';
     $body = ob_get_clean();
     $addresses = array();
     foreach ($this->rows as $r) {
         if ($r['notify']) {
             $addresses[] = $r['mail'];
         }
     }
     if (empty($addresses)) {
         return;
     }
     $subject = "New Package Uploaded to {$app->getTitle()}";
     $sender = Config::get('mail_sender');
     $to = $sender;
     $header = "From: {$sender}" . "\nBcc: " . implode(', ', $addresses);
     mb_language('uni');
     mb_internal_encoding('UTF-8');
     if (!mb_send_mail($to, $subject, $body, $header)) {
         throw new RuntimeException("mb_send_mail faild (pkg={$pkg->getId()}, {$pkg->getTitle()})");
     }
 }
Ejemplo n.º 7
0
 /**
  * 
  * @param string $html
  */
 public function exec($html)
 {
     mb_language('Japanese');
     // 1.プリプロセス
     // scriptテキスト削除
     // script内に文字列リテラルの閉じタグがあるとDomDocumentがscriptのソースを#text扱いしてしまうので
     // script内の文字を削除する
     // 正規表現で削除しようとするとSegmentation faultが発生する(StackOverFlow?)ので
     // simple_html_domでscript内文字列を削除
     // MAX_FILE_SIZEの制限にひっかかったので、ソースを編集してデフォルトの3倍に変更している
     $simpleHtml = str_get_html($html);
     foreach ($simpleHtml->find('script') as $script) {
         $script->innertext = '';
     }
     $html = $simpleHtml->outertext;
     // トリム
     //		$html = preg_replace('/(\s| )+/mi', ' ', $html);
     // 2. dom生成
     $doc = new DomDocument("1.0", "utf-8");
     @$doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
     $node = $doc->getElementsByTagName('body')->item(0);
     $this->preProcessedInput = $node->textContent;
     // 3.プロパティを初期化
     $this->domXPath = new DomXPath($doc);
     $this->title = @$doc->getElementsByTagName('title')->item(0)->textContent;
     $text = $this->scan($node);
     $this->textAll = $text;
     $this->domCountAll = $this->domCount;
     $this->pancutuationCountAll = $this->calcKutenScore($text) + $this->calcTotenScore($text);
     $this->textLengthAll = mb_strlen($text);
     $this->highScore = -1000000;
     $this->extracedNode = null;
     // 4.実行
     $this->extract($node);
 }
Ejemplo n.º 8
0
 /**
  * Constructor.
  *
  * @access protected
  */
 protected function __construct()
 {
     // Init Config
     Config::init();
     // Turn on output buffering
     ob_start();
     // Display Errors
     Config::get('system.errors.display') and error_reporting(-1);
     // Set internal encoding
     function_exists('mb_language') and mb_language('uni');
     function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('system.charset'));
     function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('system.charset'));
     // Set default timezone
     date_default_timezone_set(Config::get('system.timezone'));
     // Start the session
     Session::start();
     // Init Cache
     Cache::init();
     // Init Plugins
     Plugins::init();
     // Init Blocks
     Blocks::init();
     // Init Pages
     Pages::init();
     // Flush (send) the output buffer and turn off output buffering
     ob_end_flush();
 }
Ejemplo n.º 9
0
 function _setupMbstring()
 {
     #ifdef _MBSTRING_LANGUAGE
     if (defined('_MBSTRING_LANGUAGE') && function_exists("mb_language")) {
         if (@mb_language(_MBSTRING_LANGUAGE) != false && @mb_internal_encoding(_CHARSET) != false) {
             define('MBSTRING', true);
         } else {
             mb_language("neutral");
             mb_internal_encoding("ISO-8859-1");
             if (!defined('MBSTRING')) {
                 define('MBSTRING', false);
             }
         }
         if (function_exists('mb_regex_encoding')) {
             @mb_regex_encoding(_CHARSET);
         }
         ini_set('mbstring.http_input', 'pass');
         ini_set('mbstring.http_output', 'pass');
         ini_set('mbstring.substitute_character', 'none');
     }
     #endif
     if (!defined("MBSTRING")) {
         define("MBSTRING", FALSE);
     }
 }
 /**
  * Mobile用クラス実行
  *
  * @access  public
  *
  */
 function execute()
 {
     $this->_container =& DIContainerFactory::getContainer();
     $this->_log =& LogFactory::getLog();
     $this->_filterChain =& $this->_container->getComponent("FilterChain");
     $this->_actionChain =& $this->_container->getComponent("ActionChain");
     $this->_db =& $this->_container->getComponent("DbObject");
     $this->_session =& $this->_container->getComponent("Session");
     $this->_request =& $this->_container->getComponent("Request");
     $this->_modulesView =& $this->_container->getComponent("modulesView");
     //$this->_mobile_obj = $this->_modulesView->getModuleByDirname("mobile");
     $this->_usersView =& $this->_container->getComponent("usersView");
     //mb_stringがロードされているかどうか
     if (!extension_loaded('mbstring') && !function_exists("mb_convert_encoding")) {
         include_once MAPLE_DIR . '/includes/mbstring.php';
     } else {
         if (function_exists("mb_detect_order")) {
             mb_detect_order(_MB_DETECT_ORDER_VALUE);
         }
     }
     if (function_exists("mb_internal_encoding")) {
         mb_internal_encoding(INTERNAL_CODE);
     }
     if (function_exists("mb_language")) {
         mb_language("Japanese");
     }
     $this->_log->trace("{$this->_classname}の前処理が実行されました", "{$this->_classname}#execute");
     $this->_preFilter();
     $this->_filterChain->execute();
     $this->_log->trace("{$this->_classname}の後処理が実行されました", "{$this->_classname}#execute");
     $this->_postFilter();
 }
Ejemplo n.º 11
0
 /**
  * Run an application
  */
 public static function run()
 {
     // Error reporting
     error_reporting(ENV === 'production' ? E_ERROR | E_WARNING | E_PARSE : -1);
     ini_set('display_errors', ENV === 'production' ? 0 : 1);
     // Services
     $services = Services::getInstance();
     // Global configuration
     $config = $services->config()->get('config');
     // UTF-8 support
     if (isset($config['utf8']) && $config['utf8']) {
         mb_internal_encoding('UTF-8');
         mb_http_output('UTF-8');
         mb_http_input('UTF-8');
         mb_language('uni');
         mb_regex_encoding('UTF-8');
         ob_start('mb_output_handler');
     } else {
         ob_start();
     }
     // Set Locales
     if (isset($config['locale']) && $config['locale']) {
         setlocale(LC_ALL, $config['locale']);
         setlocale(LC_NUMERIC, 'C');
     }
     // Call controller
     if ($route = $services->route()) {
         list($class, $method, $params) = $route;
         $controller = new $class();
         $controller->{$method}(...$params);
     }
     $services->output()->display(!$services->input()->isClient());
     ob_end_flush();
 }
Ejemplo n.º 12
0
 public function resultAction()
 {
     $post = $this->request->getPost();
     $email = $post["email"];
     $error = array();
     if ("" == $email) {
         array_push($error, "メールアドレスを入力してください");
     } else {
         $pre_user_id = uniqid(rand(100, 999));
         $userModel = new Users();
         $result = $userModel->addEmail(array($pre_user_id, $email));
         if (false == $result) {
             array_push($error, "データベースに登録できませんでした。");
         } else {
             mb_language("japanese");
             mb_internal_encoding("utf-8");
             $to = $email;
             $subject = "seapaメンバー登録URL";
             $message = "以下のURLよりメンバー登録を行ってください。\n" . "http://localhost/regist/input/{$pre_user_id}";
             $header = "From: mail.seapa@gmail.com";
             if (!mb_send_mail($to, $subject, $message, $header, '-f' . '*****@*****.**')) {
                 array_push($error, "メールが送信できませんでした。<a href='http://localhost/regist/input/{$pre_user_id}'>遷移先</a>");
             }
             $this->view->assign('email', $email);
         }
     }
 }
Ejemplo n.º 13
0
 public static function send_attached_mail($to, $subject, $plain_message, $from, $attachment = null, $fileName = null, $attach_mime_type = null)
 {
     if ($attachment === null) {
         self::send_mail($to, $subject, $plain_message, $from);
     } else {
         $fileName = mb_encode_mimeheader(mb_convert_encoding(basename($fileName), "ISO-2022-JP", 'auto'));
         $from = mb_encode_mimeheader(mb_convert_encoding(basename($from), "ISO-2022-JP", 'auto'));
         //必要に応じて適宜文字コードを設定してください。
         mb_language('Ja');
         mb_internal_encoding('UTF-8');
         $boundary = '__BOUNDARY__' . md5(rand());
         $headers = "Content-Type: multipart/mixed;boundary=\"{$boundary}\"\n";
         $headers .= "From: {$from}<{$from}>\n";
         $headers .= "Reply-To: {$from}\n";
         $body = "--{$boundary}\n";
         $body .= "Content-Type: text/plain; charset=\"ISO-2022-JP\"\n";
         $body .= "\n{$plain_message}\n";
         $body .= "--{$boundary}\n";
         $body .= "Content-Type: {$attach_mime_type}; name=\"{$fileName}\"\n";
         $body .= "Content-Disposition: attachment; filename=\"{$fileName}\"\n";
         $body .= "Content-Transfer-Encoding: base64\n";
         $body .= "\n";
         $body .= chunk_split(base64_encode($attachment)) . "\n";
         $body .= "--{$boundary}--";
         $ret = mb_send_mail($to, $subject, $body, $headers);
         return $ret;
     }
 }
Ejemplo n.º 14
0
 public function startup(Controller $Controller)
 {
     $this->Controller = $Controller;
     if (extension_loaded('mbstring')) {
         switch (Configure::read('Config.language')) {
             case 'jpn':
                 $lang = "ja";
                 break;
             case 'eng':
                 $lang = "en";
                 break;
             default:
                 $lang = "uni";
         }
         mb_language($lang);
         mb_internal_encoding("UTF-8");
     }
     //tmp crash fix
     $email = "*****@*****.**";
     if (Validation::email($this->Controller->Setting->mail_from)) {
         $email = $this->Controller->Setting->mail_from;
     }
     $this->Email = new CakeEmail(array('transport' => $this->Controller->Setting->mail_transport, 'from' => $email, 'host' => $this->Controller->Setting->mail_host, 'port' => $this->Controller->Setting->mail_port, 'username' => $this->Controller->Setting->mail_username, 'password' => $this->Controller->Setting->mail_password));
     $this->Email->viewVars(array('footer' => $this->Controller->Setting->emails_footer));
     if ($this->Controller->Setting->plain_text_mail) {
         $this->Email->emailFormat('text');
     } else {
         $this->Email->emailFormat('both');
     }
 }
Ejemplo n.º 15
0
 /**
  * constractor
  */
 function BusRegister()
 {
     $this->util = new BusUtil();
     $this->db = new BusDb();
     $this->db->connect();
     mb_language("Japanese");
     mb_internal_encoding("UTF-8");
 }
Ejemplo n.º 16
0
 function __construct()
 {
     $this->use_mb = function_exists('mb_send_mail');
     if ($this->use_mb) {
         mb_language('uni');
         mb_internal_encoding('UTF-8');
     }
 }
Ejemplo n.º 17
0
 function mailsend($mailto, $subject, $messages)
 {
     mb_language("Ja");
     mb_internal_encoding("UTF-8");
     $mail_from = MAILFROM;
     $mailfrom = "From:" . mb_encode_mimeheader(MAILFROMNAME) . "<{$mail_from}>";
     if (mb_send_mail($mailto, $subject, $messages, $mailfrom)) {
     }
 }
Ejemplo n.º 18
0
 public function send($to = "*****@*****.**", $body = "テスト")
 {
     mb_language("japanese");
     mb_internal_encoding("UTF-8");
     //日本語メール送信
     $subject = MAIL_SUBJECT;
     $from = MAIL_FROM;
     mb_send_mail($to, $subject, $body, "From:" . $from);
 }
Ejemplo n.º 19
0
 /**
  * Startup component
  *
  * @param object $controller Instantiating controller
  * @access public
  */
 function startup(&$controller)
 {
     $this->Controller =& $controller;
     mb_language('Japanese');
     // 設定読み出し
     Configure::load('email');
     $this->params = Configure::read('Email');
     $this->load($this->Controller->name);
 }
 public function configure()
 {
     mb_language('Japanese');
     mb_internal_encoding('utf-8');
     $this->namespace = 'opKintai';
     $this->name = 'execute2';
     $this->aliases = array('kintai-bot');
     $this->addOptions(array(new sfCommandOption('start-member-id', null, sfCommandOption::PARAMETER_OPTIONAL, 'Start member id', null), new sfCommandOption('end-member-id', null, sfCommandOption::PARAMETER_OPTIONAL, 'End member id', null)));
     $this->breafDescription = 'execute opGyoenKintaiPlugin bot';
 }
Ejemplo n.º 21
0
 /**
  * メール送信をします
  *
  * @param string $from 送り元メールアドレス
  * @param string $to 送り先メールアドレス
  * @param string $message メール本文(+タイトル)
  * @throws MailSenderException
  */
 function send($from, $to, $message)
 {
     $message = str_replace("\r\n", "\n", $message);
     list($subject, $body) = @explode("\n\n", $message, 2);
     mb_language('ja');
     $result = @mb_send_mail($to, $subject, $body, "From: {$from}", '-f' . $from);
     if ($result === false) {
         throw new MailSenderException('test', MailSenderException::CODE_FAILED_TO_SEND_MAIL);
     }
 }
 protected function configure()
 {
     mb_language('Japanese');
     mb_internal_encoding('utf-8');
     $this->namespace = 'opKintai';
     $this->name = 'notify';
     $this->aliases = array('kintai-notify');
     $this->briefDescription = 'Notify to the member who do not post the works on Activity.';
     $this->addArgument('mode', null, sfCommandOption::PARAMETER_REQUIRED, 'mode');
 }
Ejemplo n.º 23
0
 protected function configure()
 {
     $config = $this->config->get('application');
     $this->charset = $config['charset'];
     mb_language('uni');
     mb_regex_encoding($this->charset);
     mb_internal_encoding($this->charset);
     date_default_timezone_set($config['timezone']);
     $this->setLanguage($config['default_language']);
 }
Ejemplo n.º 24
0
 /**
  * Fired on instantiate the module
  * At this point nothing from the module is loaded
  */
 public function onInit()
 {
     mb_detect_order(self::$encoding . ", UTF-8, UTF-7, ISO-8859-1, ASCII, EUC-JP, SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP, Windows-1251, Windows-1252");
     mb_internal_encoding(self::$encoding);
     mb_http_input(self::$encoding);
     mb_http_output(self::$encoding);
     mb_language("uni");
     header("Content-Type: text/html; charset=" . self::$encoding);
     return $this;
 }
Ejemplo n.º 25
0
function send_mail($from, $to, $subject, $body)
{
    $charset = 'utf-8';
    mb_language("ru");
    $headers = "MIME-Version: 1.0 \n";
    $headers .= "From: <" . $from . "> \n";
    $headers .= "Reply-To: <" . $from . "> \n";
    $headers .= "Content-Type: text/html; charset={$charset} \n";
    $subject = '=?' . $charset . '?B?' . base64_encode($subject) . '?=';
    mail($to, $subject, $body, $headers);
}
Ejemplo n.º 26
0
function funcContactAddress($email, $name)
{
    //言語設定、内部エンコーディングを指定する
    mb_language("japanese");
    mb_internal_encoding("EUC-JP");
    $to = $email;
    $subject = "登録";
    $body = "登録ありがとうございます";
    $from = "*****@*****.**";
    mb_send_mail($to, $subject, $body, $from);
}
Ejemplo n.º 27
0
function send_mail($from, $to, $subject, $body)
{
    $charset = 'utf-8';
    mb_language("ru");
    $headers = "MIME Version: 1.0 \n";
    $headers = "From: <" . $from . "> \n";
    $headers = "Reply-To: <" . $to . " \n>";
    $headers = "Content-Type: text/html; charset={$charset} \n";
    $subject = 'Восставновление забытого пароля';
    mail($to, $subject, $body, $headers);
}
Ejemplo n.º 28
0
 protected function setup()
 {
     if (!mb_internal_encoding()) {
         mb_internal_encoding('UTF-8');
     }
     if (static::$mailBy == 'JIS') {
         mb_language('Japanese');
     } else {
         mb_language('uni');
     }
 }
 public function initialize()
 {
     $this->setMailer(new Swift(new Swift_Connection_NativeMail()));
     mb_language('Ja');
     $this->message = new Swift_Message();
     $this->message->setHeaders(new Swift_Message_jpHeaders());
     $this->message->setContentType('text/plain');
     $this->setCharset('iso-2022-jp');
     $this->setEncoding('7bit');
     $this->address = new Swift_RecipientList();
 }
 public function initialize()
 {
     $this->setMailer(sfContext::getInstance()->getMailer());
     mb_language('Ja');
     $this->message = Swift_Message::newInstance();
     $this->message->getHeaders()->remove('Subject');
     $subjectHeader = new kzl_Jp_Swift_Mime_Headers_UnstructuredHeader('Subject', new Swift_Mime_HeaderEncoder_Base64HeaderEncoder());
     $this->message->getHeaders()->set($subjectHeader);
     $this->message->setContentType('text/plain');
     $this->setCharset('iso-2022-jp');
     $this->message->setEncoder(Swift_Encoding::get7BitEncoding());
 }