當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Message::getEncodedHeader方法代碼示例

本文整理匯總了PHP中Nette\Mail\Message::getEncodedHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP Message::getEncodedHeader方法的具體用法?PHP Message::getEncodedHeader怎麽用?PHP Message::getEncodedHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Mail\Message的用法示例。


在下文中一共展示了Message::getEncodedHeader方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: send

 /**
  * Sends email.
  * @param  Message
  * @return void
  */
 public function send(Message $mail)
 {
     $tmp = clone $mail;
     $tmp->setHeader('Subject', NULL);
     $tmp->setHeader('To', NULL);
     $parts = explode(Message::EOL . Message::EOL, $tmp->generateMessage(), 2);
     Nette\Diagnostics\Debugger::tryError();
     $res = mail(str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('To')), str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('Subject')), str_replace(Message::EOL, PHP_EOL, $parts[1]), str_replace(Message::EOL, PHP_EOL, $parts[0]), (string) $this->commandArgs);
     if (Nette\Diagnostics\Debugger::catchError($e)) {
         throw new Nette\InvalidStateException('mail(): ' . $e->getMessage(), 0, $e);
     } elseif (!$res) {
         throw new Nette\InvalidStateException('Unable to send email.');
     }
 }
開發者ID:kovkus,項目名稱:r-cms,代碼行數:19,代碼來源:SendmailMailer.php

示例2: send

 /**
  * Sends email.
  * @return void
  */
 public function send(Message $mail)
 {
     $tmp = clone $mail;
     $tmp->setHeader('Subject', NULL);
     $tmp->setHeader('To', NULL);
     $parts = explode(Message::EOL . Message::EOL, $tmp->generateMessage(), 2);
     $args = array(str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('To')), str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('Subject')), str_replace(Message::EOL, PHP_EOL, $parts[1]), str_replace(Message::EOL, PHP_EOL, $parts[0]));
     if ($this->commandArgs) {
         $args[] = (string) $this->commandArgs;
     }
     if (call_user_func_array('mail', $args) === FALSE) {
         $error = error_get_last();
         throw new Nette\InvalidStateException("Unable to send email: {$error['message']}.");
     }
 }
開發者ID:vrtak-cz,項目名稱:nette-doctrine-sandbox,代碼行數:19,代碼來源:SendmailMailer.php

示例3: send

 /**
  * Sends email.
  * @return void
  */
 public function send(Message $mail)
 {
     $tmp = clone $mail;
     $tmp->setHeader('Subject', NULL);
     $tmp->setHeader('To', NULL);
     $parts = explode(Message::EOL . Message::EOL, $tmp->generateMessage(), 2);
     $args = array(str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('To')), str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('Subject')), str_replace(Message::EOL, PHP_EOL, $parts[1]), str_replace(Message::EOL, PHP_EOL, $parts[0]));
     if ($this->commandArgs) {
         $args[] = (string) $this->commandArgs;
     }
     $res = Nette\Utils\Callback::invokeSafe('mail', $args, function ($message) use(&$info) {
         $info = ": {$message}";
     });
     if ($res === FALSE) {
         throw new Nette\InvalidStateException("Unable to send email{$info}.");
     }
 }
開發者ID:vol0054,項目名稱:vizitky,代碼行數:21,代碼來源:SendmailMailer.php

示例4: send

 /**
  * Sends email.
  * @return void
  */
 public function send(Message $mail)
 {
     $tmp = clone $mail;
     $tmp->setHeader('Subject', NULL);
     $tmp->setHeader('To', NULL);
     $parts = explode(Message::EOL . Message::EOL, $tmp->generateMessage(), 2);
     $args = array(str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('To')), str_replace(Message::EOL, PHP_EOL, $mail->getEncodedHeader('Subject')), str_replace(Message::EOL, PHP_EOL, $parts[1]), str_replace(Message::EOL, PHP_EOL, $parts[0]));
     if ($this->commandArgs) {
         $args[] = (string) $this->commandArgs;
     }
     set_error_handler(function ($severity, $message) use(&$info) {
         $info = ": {$message}";
     });
     $res = call_user_func_array('mail', $args);
     restore_error_handler();
     if ($res === FALSE) {
         throw new Nette\InvalidStateException("Unable to send email{$info}.");
     }
 }
開發者ID:prcharom,項目名稱:w-pps-reality,代碼行數:23,代碼來源:SendmailMailer.php


注:本文中的Nette\Mail\Message::getEncodedHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。