本文整理匯總了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');
}
}