本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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;
}