本文整理汇总了PHP中Swift_Events_SendEvent类的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Events_SendEvent类的具体用法?PHP Swift_Events_SendEvent怎么用?PHP Swift_Events_SendEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Swift_Events_SendEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testBeforeSendPerformedWithInvalidMessage
public function testBeforeSendPerformedWithInvalidMessage()
{
$this->event = $this->getMockBuilder(\Swift_Events_SendEvent::class)->disableOriginalConstructor()->getMock();
$this->event->expects($this->any())->method('getMessage')->will($this->returnValue(new \stdClass()));
$this->message->expects($this->never())->method('attachSigner');
$this->plugin->beforeSendPerformed($this->event);
}
开发者ID:sonatra,项目名称:SonatraMailerBundle,代码行数:7,代码来源:DkimSignerPluginTest.php
示例2: beforeSendPerformed
/**
* @param \Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$this->convert($message);
$children = $message->getChildren();
array_walk($children, array($this, 'convert'));
}
开发者ID:Codixis,项目名称:CSBill,代码行数:10,代码来源:CssInlinerPlugin.php
示例3: sendPerformed
/**
* Part of the interface which is notified when a message has been sent.
* @param Swift_Events_SendEvent
*/
public function sendPerformed(Swift_Events_SendEvent $e)
{
$recipients = $e->getRecipients();
$failed = $e->getFailedRecipients();
$it = $recipients->getIterator("to");
while ($it->hasNext()) {
$it->next();
$address = $it->getValue();
$pass = !in_array($address->getAddress(), $failed);
$this->getView()->paintResult($address->getAddress(), $pass);
}
$it = $recipients->getIterator("cc");
while ($it->hasNext()) {
$it->next();
$address = $it->getValue();
$pass = !in_array($address->getAddress(), $failed);
$this->getView()->paintResult($address->getAddress(), $pass);
}
$it = $recipients->getIterator("bcc");
while ($it->hasNext()) {
$it->next();
$address = $it->getValue();
$pass = !in_array($address->getAddress(), $failed);
$this->getView()->paintResult($address->getAddress(), $pass);
}
}
开发者ID:auphau,项目名称:joyreactor,代码行数:30,代码来源:VerboseSending.php
示例4: beforeSendPerformed
/**
* Invoked immediately before the Message is sent.
*
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
$this->messages[] = $message = clone $evt->getMessage();
$to = null === $message->getTo() ? '' : implode(', ', array_keys($message->getTo()));
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Sending email "%s" to "%s"', $message->getSubject(), $to))));
}
开发者ID:nationalfield,项目名称:symfony,代码行数:13,代码来源:sfMailerMessageLoggerPlugin.class.php
示例5: sendPerformed
public function sendPerformed(\Swift_Events_SendEvent $event)
{
// If this was sent through SES, retrieve the data
if (config('mail.driver') == 'ses') {
$message = $event->getMessage();
$this->updateSesMessageId($message);
}
}
开发者ID:jdavidbakr,项目名称:mail-tracker,代码行数:8,代码来源:MailTracker.php
示例6: sendPerformed
/**
* Gestion des messages apres leur envoi
* @param Swift_Events_SendEvent $event [description]
* @return [type] [description]
*/
public function sendPerformed(\Swift_Events_SendEvent $evt)
{
if ($evt->getResult() === \Swift_Events_SendEvent::RESULT_SUCCESS && $this->enabled == true) {
// Création de l'activity
$activity = $this->createActivity($evt->getMessage());
$this->dm->persist($activity);
$this->dm->flush();
}
}
开发者ID:studiocaramia,项目名称:redking_MailBundle,代码行数:14,代码来源:SwiftEventListener.php
示例7: beforeSendPerformed
/**
* {@inheritdoc}
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $event)
{
$message = $event->getMessage();
if (!$this->isEnabled() || !$message instanceof \Swift_Message || in_array($message->getId(), $this->performed)) {
return;
}
$signature = new \Swift_Signers_DKIMSigner($this->getPrivateKey(), $this->domain, $this->selector);
$message->attachSigner($signature);
$this->performed[] = $message->getId();
}
开发者ID:sonatra,项目名称:SonatraMailerBundle,代码行数:13,代码来源:DkimSignerPlugin.php
示例8: sendPerformed
/**
* Invoked immediately after the Message is sent.
*
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
// restore original headers
$headers = $message->getHeaders();
if ($headers->has('X-Swift-Return-Path')) {
$message->setReturnPath($headers->get('X-Swift-Return-Path')->getAddress());
$headers->removeAll('X-Swift-Return-Path');
}
}
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:15,代码来源:ImpersonatePlugin.php
示例9: beforeSendPerformed
/**
* @param \Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
if ($message->getContentType() === 'text/html' || $message->getContentType() === 'multipart/alternative' && $message->getBody() || $message->getContentType() === 'multipart/mixed' && $message->getBody()) {
$message->setBody($this->converter->convert($message->getBody(), $this->css));
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$part->setBody($this->converter->convert($part->getBody(), $this->css));
}
}
}
开发者ID:fedeisas,项目名称:laravel-mail-css-inliner,代码行数:15,代码来源:CssInlinerPlugin.php
示例10: sendPerformed
/**
* Invoked immediately after the Message is sent.
*
* @param \Swift_Events_SendEvent $evt
*/
public function sendPerformed(\Swift_Events_SendEvent $evt)
{
$result = $evt->getResult();
$failed_recipients = $evt->getFailedRecipients();
$message = $evt->getMessage();
if ($result === \Swift_Events_SendEvent::RESULT_SUCCESS) {
$level = $this->levels['sendPerformed.SUCCESS'];
} else {
$level = $this->levels['sendPerformed.NOT_SUCCESS'];
}
$this->log($level, 'MESSAGE (sendPerformed): ', array('result' => $result, 'failed_recipients' => $failed_recipients, 'message' => $message->toString()));
}
开发者ID:gcrico,项目名称:swift-mailer-psr-logger-plugin,代码行数:17,代码来源:SwiftMailerPsrLoggerPlugin.php
示例11: beforeSendPerformed
/**
* Inline the CSS before an email is sent.
*
* @param \Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$properTypes = ['text/html', 'multipart/alternative', 'multipart/mixed'];
if ($message->getBody() && in_array($message->getContentType(), $properTypes)) {
$this->inliner->setHtml($message->getBody());
$message->setBody($this->inliner->emogrify());
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$this->inliner->setHtml($part->getBody());
$message->setBody($this->inliner->emogrify());
}
}
}
开发者ID:snowfire,项目名称:beautymail,代码行数:20,代码来源:CssInlinerPlugin.php
示例12: beforeSendPerformed
/**
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$converter = new CssToInlineStyles();
$converter->setEncoding($message->getCharset());
$converter->setUseInlineStylesBlock();
$converter->setCleanup();
if ($message->getContentType() === 'text/html' || $message->getContentType() === 'multipart/alternative' && $message->getBody() || $message->getContentType() === 'multipart/mixed' && $message->getBody()) {
$converter->setHTML($message->getBody());
$message->setBody($converter->convert());
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$converter->setHTML($part->getBody());
$part->setBody($converter->convert());
}
}
}
开发者ID:pabloroman,项目名称:laravel-mail-css-inliner,代码行数:21,代码来源:CssInlinerPlugin.php
示例13: beforeSendPerformed
/**
* {@inheritdoc}
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $event)
{
$message = $event->getMessage();
if (!$this->isEnabled() || !$message instanceof \Swift_Message || in_array($message->getId(), $this->performed) || null === $message->getBody()) {
return;
}
$dom = new \DOMDocument('1.0', 'utf-8');
$internalErrors = libxml_use_internal_errors(true);
$dom->loadHTML($message->getBody());
libxml_use_internal_errors($internalErrors);
$xpath = new \DOMXPath($dom);
$nodes = $xpath->query('//img/@src');
$images = array();
foreach ($nodes as $node) {
$this->embedImage($message, $node, $images);
}
$message->setBody($dom->saveHTML(), 'text/html');
$this->performed[] = $message->getId();
}
开发者ID:sonatra,项目名称:SonatraMailerBundle,代码行数:22,代码来源:EmbedImagePlugin.php
示例14: sendPerformed
/**
* Swift's SendEvent listener.
* Invoked when Swift sends a message
* @param Swift_Events_SendEvent The event information
* @throws Swift_ConnectionException If the connection cannot be rotated
*/
public function sendPerformed(Swift_Events_SendEvent $e)
{
if (!method_exists($e->getSwift()->connection, "nextConnection")) {
throw new Swift_ConnectionException("The ConnectionRotator plugin cannot be used with connections other than Swift_Connection_Rotator.");
}
if (!$this->called) {
$this->used[] = $e->getSwift()->connection->getActive();
}
$this->count++;
if ($this->count >= $this->getThreshold()) {
$e->getSwift()->connection->nextConnection();
if (!in_array($id = $e->getSwift()->connection->getActive(), $this->used)) {
$e->getSwift()->connect();
$this->used[] = $id;
}
$this->count = 0;
}
$this->called = true;
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:25,代码来源:ConnectionRotator.php
示例15: sendPerformed
/**
* Invoked immediately after the Message is sent.
*
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
$this->_restoreMessage($evt->getMessage());
}
开发者ID:saj696,项目名称:pipe,代码行数:9,代码来源:RedirectingPlugin.php
示例16: beforeSendPerformed
/**
* Invoked immediately before the Message is sent.
*
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
$this->messages[] = clone $evt->getMessage();
}
开发者ID:TuxCoffeeCorner,项目名称:tcc,代码行数:9,代码来源:MessageLogger.php
示例17: beforeSendPerformed
/**
* Invoked immediately before the Message is sent.
*
* @param \Swift_Events_SendEvent $event
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $event)
{
$event->getMessage()->setFrom($this->address, $this->name);
}
开发者ID:amirkheirabadi,项目名称:pagekit,代码行数:9,代码来源:ImpersonatePlugin.php
示例18: sendPerformed
/**
* Swift's SendEvent listener.
* Invoked when Swift sends a message
* @param Swift_Events_SendEvent The event information
* @throws Swift_ConnectionException If the connection cannot be closed/re-opened
*/
public function sendPerformed(Swift_Events_SendEvent $e)
{
$this->count++;
if ($this->count >= $this->getThreshold()) {
$e->getSwift()->disconnect();
$this->wait($this->getWait());
$e->getSwift()->connect();
$this->count = 0;
}
}
开发者ID:auphau,项目名称:joyreactor,代码行数:16,代码来源:AntiFlood.php
示例19: sendPerformed
/**
* Invoked immediately after the Message is sent.
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $event)
{
$this->logger->add(sprintf("Sent Emails, Failed Recipients: ", join(', ', $event->getFailedRecipients())));
}
开发者ID:openbuildings,项目名称:html-email,代码行数:8,代码来源:Fullloggerplugin.php
示例20: beforeSendPerformed
/**
* Swift's BeforeSendListener required method.
* Runs just before Swift sends a message. Here is where we do all the replacements.
* @param Swift_Events_SendEvent
*/
public function beforeSendPerformed(Swift_Events_SendEvent $e)
{
$this->message = $e->getMessage();
foreach ($this->message->listChildren() as $id) {
$part = $this->message->getChild($id);
$body = $part->getData();
if (!is_string($body) || substr(strtolower($part->getContentType()), 0, 5) != "text/") {
continue;
}
foreach ($this->definitions as $tag_name => $def) {
if ($this->getEmbedRemoteFiles()) {
$re = $this->getRemoteFilePattern($tag_name);
$body = preg_replace_callback($re, array($this, "embedRemoteFile"), $body);
}
if ($this->getEmbedLocalFiles()) {
$re = $this->getLocalFilePattern($tag_name);
$body = preg_replace_callback($re, array($this, "embedLocalFile"), $body);
}
}
$part->setData($body);
}
}
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:27,代码来源:FileEmbedder.php
注:本文中的Swift_Events_SendEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论