本文整理汇总了PHP中Swift_Mime_Message::getBody方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Mime_Message::getBody方法的具体用法?PHP Swift_Mime_Message::getBody怎么用?PHP Swift_Mime_Message::getBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Mime_Message
的用法示例。
在下文中一共展示了Swift_Mime_Message::getBody方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: returnOneValidateCampaignUrls
public function returnOneValidateCampaignUrls(\Swift_Mime_Message $message, &$failedRecipients = null)
{
$body = $message->getBody();
// has a email-tracking-image at the end
$this->assertContains("<img src='https://www.google-analytics.com/?tid=blabla", $body, "Email open tracking image not found.");
// links have tracking-parameters
$this->assertContains("&utm_medium=email", $body, "Email links are expected to have tracking parameters attached.");
return 1;
}
示例2: transform
/**
* {@inheritdoc)
*/
public function transform(\Swift_Mime_Message $message)
{
$processor = new Process($this->getCommand());
$processor->setStdin($message->getBody());
$processor->run();
if ($processor->isSuccessful()) {
$message->addPart($processor->getOutput(), 'text/plain');
}
}
示例3: send
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$failedRecipients = (array) $failedRecipients;
$msg = '* ' . $message->getSubject() . ' *' . PHP_EOL . PHP_EOL;
if ($message instanceof CM_Mail_Message) {
$msg .= $message->getText() . PHP_EOL;
} else {
$msg .= $message->getBody() . PHP_EOL;
}
$logger = $this->getLogger();
$context = new CM_Log_Context();
$context->setExtra(['type' => CM_Paging_Log_Mail::getTypeStatic(), 'sender' => $message->getSender(), 'replyTo' => $message->getReplyTo(), 'to' => $message->getTo(), 'cc' => $message->getCc(), 'bcc' => $message->getBcc()]);
$logger->addMessage($msg, $this->_logLevel, $context);
return count($message->getTo()) + count($message->getCc()) + count($message->getBcc());
}
示例4: transform
/**
* {@inheritdoc)
*/
public function transform(\Swift_Mime_Message $message)
{
$body = $message->getBody();
$body = preg_replace_callback('/(src|background)="(http[^"]*)"/', function ($matches) use($message) {
$attribute = $matches[1];
$imagePath = $matches[2];
if ($fp = fopen($imagePath, "r")) {
$imagePath = $message->embed(\Swift_Image::fromPath($imagePath));
fclose($fp);
}
return sprintf('%s="%s"', $attribute, $imagePath);
}, $body);
$body = preg_replace_callback('/url\\((http[^"]*)\\)/', function ($matches) use($message) {
$imagePath = $matches[1];
if ($fp = fopen($imagePath, "r")) {
$imagePath = $message->embed(\Swift_Image::fromPath($imagePath));
fclose($fp);
}
return sprintf('url(%s)', $imagePath);
}, $body);
$message->setBody($body, 'text/html');
}
示例5: content
/**
* Get the HTML content for the preview file.
*
* @return string
*/
private function content()
{
return $this->info() . $this->message->getBody();
}
示例6: Html2Text
/**
* Define email to text/plain
*
* @param \Swift_Mime_Message $message E-mail message
*
* @access public
* @return void
* @author Etienne de Longeaux <etienne.delongeaux@gmail.com>
*/
public function Html2Text(\Swift_Mime_Message &$message)
{
$text = strip_tags($message->getBody());
$message->addPart($text, 'text/plain');
}