本文整理汇总了PHP中Swift_Mime_Message::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Mime_Message::toString方法的具体用法?PHP Swift_Mime_Message::toString怎么用?PHP Swift_Mime_Message::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Mime_Message
的用法示例。
在下文中一共展示了Swift_Mime_Message::toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* "Send" the given Message. This transport will add it to a stored collection of sent messages
* for testing purposes and log the message to the system logger.
*
* @param \Swift_Mime_Message $message The message to send
* @param array &$failedRecipients Failed recipients
* @return integer
*/
public function send(\Swift_Mime_Message $message, &$failedRecipients = null)
{
self::$deliveredMessages[] = $message;
$this->systemLogger->log('Sent email to ' . $this->buildStringFromEmailAndNameArray($message->getTo()), LOG_DEBUG, array('message' => $message->toString()));
return count((array) $message->getTo()) + count((array) $message->getCc()) + count((array) $message->getBcc());
}
示例2: send
/**
* Sends the given message.
*
* @param Swift_Mime_Message $message
* @param string[] $failedRecipients An array of failures by-reference
*
* @return int The number of sent emails
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$hFile = @fopen($this->sLogFile, 'a');
if ($hFile) {
$sTxt = "================== " . date('Y-m-d H:i:s') . " ==================\n";
$sTxt .= $message->toString() . "\n";
@fwrite($hFile, $sTxt);
@fclose($hFile);
}
return parent::send($message, $failedRecipients);
}
示例3: saveToFile
/**
* Save the complete message to the filesystem for testing and debugging
*
* @param Swift_Mime_Message $message the email message to log
* @throws CException if the file system is not writeable
*/
protected function saveToFile(Swift_Mime_Message $message)
{
if (!$this->logDirectory) {
$this->logDirectory = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . "email";
}
if (($logPath = realpath($this->logDirectory)) === false || !is_dir($logPath) || !is_writable($logPath)) {
mkdir($this->logDirectory, 0777, true);
}
$fileName = 'SwiftMailer_' . $_SERVER['REQUEST_TIME'] . '_' . mt_rand() . '.tmp';
$file = $this->logDirectory . DIRECTORY_SEPARATOR . $fileName;
if (!is_writable(dirname($file))) {
throw new CException('Email log directory "' . dirname($file) . '" does not exist or is not writable');
}
if (!file_put_contents($file, quoted_printable_decode($message->toString()))) {
throw new CException('Unable to log mail');
}
}