当前位置: 首页>>代码示例>>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;未经允许,请勿转载。