示例#1
0
 /**
  * メールの内容をDBに保存する
  * @param ebi.Mail $mail
  */
 public function send_mail(\ebi\Mail $mail)
 {
     $data = $mail->get();
     $header = $data['header'];
     $self = new static();
     $self->from($data['from']);
     $self->to(implode(PHP_EOL, array_keys($data['to'])));
     $self->cc(implode(PHP_EOL, array_keys($data['cc'])));
     $self->bcc(implode(PHP_EOL, array_keys($data['bcc'])));
     $self->subject($data['subject']);
     $self->message($data['message']);
     $self->tcode(array_key_exists('X-T-Code', $header) ? $header['X-T-Code'] : null);
     $self->manuscript($mail->manuscript());
     $self->save();
     self::commit();
 }
示例#2
0
文件: Man.php 项目: tokushima/ebi
 public static function mail_template_list()
 {
     $path = \ebi\Conf::get(\ebi\Mail::class . '@resource_path', \ebi\Conf::resource_path('mail'));
     $template_list = [];
     try {
         foreach (\ebi\Util::ls($path, true, '/\\.xml$/') as $f) {
             $info = new \ebi\Dt\DocInfo();
             $info->name(str_replace(\ebi\Util::path_slash($path, null, true), '', $f->getPathname()));
             try {
                 $xml = \ebi\Xml::extract(file_get_contents($f->getPathname()), 'mail');
                 $info->document($xml->find_get('subject')->value());
                 $info->set_opt('x_t_code', \ebi\Mail::xtc($info->name()));
                 $template_list[] = $info;
             } catch (\ebi\exception\NotFoundException $e) {
             }
         }
     } catch (\ebi\exception\InvalidArgumentException $e) {
     }
     return $template_list;
 }