Esempio n. 1
0
 /**
  * メールの内容をDBに保存する
  * @module org.rhaco.net.mail.Mail
  * @param org.rhaco.net.mail.Mail $mail
  */
 public function send_mail(\org\rhaco\net\mail\Mail $mail)
 {
     $self = new self();
     $self->from($mail->from());
     $self->to(implode("\n", array_keys($mail->to())));
     $self->cc(implode("\n", array_keys($mail->cc())));
     $self->bcc(implode("\n", array_keys($mail->bcc())));
     $self->subject(mb_convert_encoding(base64_decode(preg_replace('/^=\\?ISO-2022-JP\\?B\\?(.+)\\?=$/', '\\1', $mail->subject())), 'UTF-8', 'JIS'));
     $self->message(mb_convert_encoding($mail->message(), 'UTF-8', 'JIS'));
     $self->manuscript($mail->manuscript());
     $self->save();
     self::commit();
 }
Esempio n. 2
0
 /**
  * @module org.rhaco.net.mail.Mail
  * @param org.rhaco.net.mail.Mail $mail
  */
 public function send_mail(\org\rhaco\net\mail\Mail $mail)
 {
     if ('' == fgets($this->resource, 4096)) {
         throw new \org\rhaco\net\mail\module\SendGmail\Exception('not connection');
     }
     $this->talk('HELO ' . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'localhost'));
     $this->talk('AUTH LOGIN');
     $this->talk(base64_encode($this->login));
     $this->talk(base64_encode($this->password));
     $this->talk(sprintf('MAIL FROM: <%s>', $this->login));
     foreach (array_keys($mail->to()) as $to) {
         $this->talk(sprintf('RCPT TO: <%s>', $to));
     }
     $this->talk('DATA');
     $this->talk($mail->manuscript() . '.');
     $rtn = $this->talk('QUIT');
 }
Esempio n. 3
0
 /**
  * @module org.rhaco.net.mail.Mail
  * @param org.rhaco.net.mail.Mail $mail
  */
 public function send_mail(\org\rhaco\net\mail\Mail $mail)
 {
     if (!$this->is_connected() && !$this->login()) {
         new \org\rhaco\net\mail\module\Smtp\Exception('not connected');
     }
     $this->talk(sprintf('MAIL FROM: <%s>', $mail->from()));
     foreach ($mail->to() as $email => $addr) {
         $this->talk(sprintf('RCPT TO: <%s>', $email));
     }
     foreach ($mail->cc() as $email => $addr) {
         $this->talk(sprintf('RCPT TO: <%s>', $email));
     }
     foreach ($mail->bcc() as $email => $addr) {
         $this->talk(sprintf('RCPT TO: <%s>', $email));
     }
     $this->talk('DATA');
     $this->talk(preg_replace('/^\\.(\\r?\\n)/m', '..$1', $mail->manuscript()) . '.');
 }