Example #1
0
 /**
  * メールを送信する
  */
 public function sendmail()
 {
     $vars = ['abc' => 'ABC'];
     $mail = new \ebi\Mail();
     $mail->to("*****@*****.**");
     $mail->send_template('send.xml', $vars);
     /**
      * メール送信拡張
      * @param string $address
      */
     self::call_class_plugin_funcs('plguin_sendmail', $address);
 }
Example #2
0
File: to.php Project: tokushima/ebi
<?php

$mail = new \ebi\Mail();
$mail->to("*****@*****.**", "abc");
$mail->to("*****@*****.**");
$mail->to("*****@*****.**", "ghi");
eq(array('*****@*****.**' => '"=?ISO-2022-JP?B?YWJj?=" <*****@*****.**>', '*****@*****.**' => '"*****@*****.**" <*****@*****.**>', '*****@*****.**' => '"=?ISO-2022-JP?B?Z2hp?=" <*****@*****.**>'), $mail->get('to'));
Example #3
0
<?php

$mail = new \ebi\Mail();
$mail->return_path("*****@*****.**");
$mail->return_path("*****@*****.**");
eq("*****@*****.**", $mail->get('return_path'));
Example #4
0
 /**
  * メールの拡張
  * @param string $address
  */
 public function plguin_sendmail($address)
 {
     $mail = new \ebi\Mail();
     $mail->to($address);
     $mail->send_template('plugin/send.xml', $vars);
 }
Example #5
0
<?php

$mail = new \ebi\Mail();
$mail->subject("改行は\r\n削除される");
eq("改行は削除される", $mail->get('subject'));
meq('Subject: =?ISO-2022-JP?B?GyRCMn45VCRPOm89fCQ1JGwkaxsoQg==?=', $mail->manuscript());
Example #6
0
 /**
  * @param \ebi\Log $log
  */
 public function log_output(\ebi\Log $log)
 {
     $mail = new \ebi\Mail();
     /**
      * @param mixed{} $arg1 メールにバインドする変数
      */
     $vars = \ebi\Conf::gets('vars');
     /**
      * @param string $arg1 fromのメールアドレス
      */
     $from = \ebi\Conf::get('from');
     /**
      * @param string $arg1 toのメールアドレス
      */
     $to = \ebi\Conf::get('to');
     if (!empty($from)) {
         if (is_string($from)) {
             $mail->from($from);
         } else {
             if (isset($from['address'])) {
                 $mail->from($from['address'], isset($from['name']) ? $from['name'] : null);
             }
         }
     }
     if (!empty($to)) {
         if (is_string($to)) {
             $mail->to($to);
         } else {
             if (isset($to['address'])) {
                 $mail->to($to['address'], isset($to['name']) ? $to['name'] : null);
             } else {
                 if (is_array($to)) {
                     foreach ($to as $t) {
                         if (isset($t['address'])) {
                             $mail->to($t['address'], isset($t['name']) ? $t['name'] : null);
                         }
                     }
                 }
             }
         }
     }
     if (!is_array($vars)) {
         $vars = [];
     }
     $template = '';
     switch ($log->level()) {
         case 0:
             $template = 'logs/emergency.xml';
             break;
         case 1:
             $template = 'logs/alert.xml';
             break;
         case 2:
             $template = 'logs/critical.xml';
             break;
         case 3:
             $template = 'logs/error.xml';
             break;
         case 4:
             $template = 'logs/warning.xml';
             break;
         case 5:
             $template = 'logs/notice.xml';
             break;
         case 6:
             $template = 'logs/info.xml';
             break;
         case 7:
             $template = 'logs/debug.xml';
             break;
     }
     try {
         $mail->send_template($template, array_merge($vars, ['log' => $log, 'env' => new \ebi\Env()]));
     } catch (\ebi\exception\InvalidArgumentException $e) {
     }
 }
Example #7
0
<?php

$mail = new \ebi\Mail();
$mail->message("メッセージ");
eq("メッセージ", $mail->get('message'));
meq('B%a%C%;!<%8', $mail->manuscript());
$mail = new \ebi\Mail();
$mail->message("メッセージ");
$mail->attach('hoge.txt', 'ほげ');
eq("メッセージ", $mail->get('message'));
meq('B%a%C%;!<%8', $mail->manuscript());
meq('44G744GS', $mail->manuscript());
$mail = new \ebi\Mail();
$mail->message("メッセージ");
$mail->html('<html><body>ふご</body></html>');
eq("メッセージ", $mail->get('message'));
meq('B%a%C%;!<%8', $mail->manuscript());
meq('B$U$4', $mail->manuscript());
$mail = new \ebi\Mail();
$mail->message("メッセージ");
$mail->attach('hoge.txt', 'ほげ');
$mail->html('<html><body>ふご</body></html>');
eq("メッセージ", $mail->get('message'));
meq('B%a%C%;!<%8', $mail->manuscript());
meq('B$U$4', $mail->manuscript());
meq('44G744GS', $mail->manuscript());
Example #8
0
<?php

$mail = new \ebi\Mail();
$mail->from('*****@*****.**');
$mail->to('*****@*****.**');
$mail->send('subject', 'body');
$dao = \ebi\SmtpBlackholeDao::find_get(\ebi\Q::order('-id'));
eq('subject', $dao->subject());
eq('body', $dao->message());
eq('*****@*****.**', $dao->to());
Example #9
0
<?php

$vars = ['abc' => 'ABC'];
$mail = new \ebi\Mail();
$mail->to("*****@*****.**");
$mail->send_template('send.xml', $vars);
$xml = \ebi\Dt::find_mail('*****@*****.**');
eq(<<<__DATA
123ABC456

=======================
 Signature
  tokushima
=======================

__DATA
, $xml->message());
eq('テストサブジェクト', $xml->subject());
$vars = ['abc' => 'ABC'];
$mail = new \ebi\Mail();
$mail->to("*****@*****.**");
$mail->send_template('send_html.xml', $vars);
$xml = \ebi\Dt::find_mail('*****@*****.**');
eq('123ABC456' . "\n", $xml->message());
eq('テストサブジェクト', $xml->subject());
meq('Content-Type: text/html;', $xml->manuscript());
meq('<p class="abc">ピーボディー</p>', mb_convert_encoding($xml->manuscript(), 'UTF8', 'JIS'));
meq('send_html.css', mb_convert_encoding($xml->manuscript(), 'UTF8', 'JIS'));