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


PHP Swift_Mime_Message::generateId方法代碼示例

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


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

示例1: send

 /**
  * Outputs the mail to a text file according to RFC 4155.
  *
  * @param Swift_Mime_Message $message The message to send
  * @param string[] &$failedRecipients To collect failures by-reference, nothing will fail in our debugging case
  * @return int
  * @throws \RuntimeException
  */
 public function send(\Swift_Mime_Message $message, &$failedRecipients = NULL)
 {
     $message->generateId();
     // Create a mbox-like header
     $mboxFrom = $this->getReversePath($message);
     $mboxDate = strftime('%c', $message->getDate());
     $messageStr = sprintf('From %s  %s', $mboxFrom, $mboxDate) . LF;
     // Add the complete mail inclusive headers
     $messageStr .= $message->toString();
     $messageStr .= LF . LF;
     $lockObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Locking\\Locker', $this->debugFile, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
     /** @var \TYPO3\CMS\Core\Locking\Locker $lockObject */
     $lockObject->acquire();
     // Write the mbox file
     $file = @fopen($this->debugFile, 'a');
     if (!$file) {
         $lockObject->release();
         throw new \RuntimeException(sprintf('Could not write to file "%s" when sending an email to debug transport', $this->debugFile), 1291064151);
     }
     @fwrite($file, $messageStr);
     @fclose($file);
     \TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions($this->debugFile);
     $lockObject->release();
     // Return every receipient as "delivered"
     $count = count((array) $message->getTo()) + count((array) $message->getCc()) + count((array) $message->getBcc());
     return $count;
 }
開發者ID:nicksergio,項目名稱:TYPO3v4-Core,代碼行數:35,代碼來源:MboxTransport.php

示例2: send

 /**
  * Outputs the mail to a text file according to RFC 4155.
  *
  * @param \Swift_Mime_Message $message The message to send
  * @param string[] &$failedRecipients To collect failures by-reference, nothing will fail in our debugging case
  * @return int
  * @throws \RuntimeException
  */
 public function send(\Swift_Mime_Message $message, &$failedRecipients = null)
 {
     $message->generateId();
     // Create a mbox-like header
     $mboxFrom = $this->getReversePath($message);
     $mboxDate = strftime('%c', $message->getDate());
     $messageStr = sprintf('From %s  %s', $mboxFrom, $mboxDate) . LF;
     // Add the complete mail inclusive headers
     $messageStr .= $message->toString();
     $messageStr .= LF . LF;
     $lockFactory = GeneralUtility::makeInstance(LockFactory::class);
     $lockObject = $lockFactory->createLocker('mbox');
     $lockObject->acquire();
     // Write the mbox file
     $file = @fopen($this->debugFile, 'a');
     if (!$file) {
         $lockObject->release();
         throw new \RuntimeException(sprintf('Could not write to file "%s" when sending an email to debug transport', $this->debugFile), 1291064151);
     }
     @fwrite($file, $messageStr);
     @fclose($file);
     GeneralUtility::fixPermissions($this->debugFile);
     $lockObject->release();
     // Return every recipient as "delivered"
     $count = count((array) $message->getTo()) + count((array) $message->getCc()) + count((array) $message->getBcc());
     return $count;
 }
開發者ID:graurus,項目名稱:testgit_t37,代碼行數:35,代碼來源:MboxTransport.php

示例3: send

 /**
  * Outputs the mail to a text file according to RFC 4155.
  *
  * @param \Swift_Mime_Message $message The message to send
  * @param array &$failedRecipients Failed recipients (no failures in this transport)
  * @return integer
  */
 public function send(\Swift_Mime_Message $message, &$failedRecipients = NULL)
 {
     $message->generateId();
     // Create a mbox-like header
     $mboxFrom = $this->getReversePath($message);
     $mboxDate = strftime('%c', $message->getDate());
     $messageString = sprintf('From %s  %s', $mboxFrom, $mboxDate) . chr(10);
     // Add the complete mail inclusive headers
     $messageString .= $message->toString();
     $messageString .= chr(10) . chr(10);
     // Write the mbox file
     file_put_contents($this->mboxPathAndFilename, $messageString, FILE_APPEND | LOCK_EX);
     // Return every receipient as "delivered"
     return count((array) $message->getTo()) + count((array) $message->getCc()) + count((array) $message->getBcc());
 }
開發者ID:simstern,項目名稱:swiftmailer,代碼行數:22,代碼來源:MboxTransport.php

示例4: send

 /**
  * Outputs the mail to a text file according to RFC 4155.
  *
  * @param Swift_Mime_Message $message The message to send
  * @param string[] &$failedRecipients To collect failures by-reference, nothing will fail in our debugging case
  * @return int
  * @throws Exception
  */
 public function send(Swift_Mime_Message $message, &$failedRecipients = null)
 {
     $message->generateId();
     // Create a mbox-like header
     $mboxFrom = $this->getReversePath($message);
     $mboxDate = strftime('%c', $message->getDate());
     $messageStr = sprintf('From %s  %s', $mboxFrom, $mboxDate) . LF;
     // Add the complete mail inclusive headers
     $messageStr .= $message->toString();
     $messageStr .= LF . LF;
     // Write the mbox file
     $file = @fopen($this->debugFile, 'a');
     if (!$file) {
         throw new Exception(sprintf('Could not write to file "%s" when sending an email to debug transport', $this->debugFile), 1291064151);
     }
     flock($file, LOCK_EX);
     @fwrite($file, $messageStr);
     flock($file, LOCK_UN);
     @fclose($file);
     t3lib_div::fixPermissions($this->debugFile);
     // Return every receipient as "delivered"
     $count = count((array) $message->getTo()) + count((array) $message->getCc()) + count((array) $message->getBcc());
     return $count;
 }
開發者ID:NaveedWebdeveloper,項目名稱:Test,代碼行數:32,代碼來源:class.t3lib_mail_mboxtransport.php


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