YiiMail -> log del envio de swiftMailer

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@34 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
roberto 2012-09-26 13:57:37 +00:00
parent abd7318032
commit 1dedcb373c

View File

@ -97,6 +97,9 @@ class YiiMail extends CApplicationComponent
*/
protected $mailer;
protected $logger;
private static $registeredScripts = false;
/**
@ -128,9 +131,12 @@ class YiiMail extends CApplicationComponent
* @see batchSend()
*/
public function send(YiiMailMessage $message, &$failedRecipients = null) {
$counter = 0;
if ($this->logging===true) self::log($message);
if ($this->dryRun===true) return count($message->to);
else return $this->getMailer()->send($message->message, $failedRecipients);
if ($this->dryRun===true) $counter = count($message->to);
else $counter = $this->getMailer()->send($message->message, $failedRecipients);
if ($this->logging===true) Yii::log(CVarDumper::dumpAsString($this->logger->dump()), CLogger::LEVEL_INFO, 'ext.yii-mail.YiiMail');
return $counter;
}
/**
@ -225,6 +231,11 @@ class YiiMail extends CApplicationComponent
public function getMailer() {
if ($this->mailer===null)
$this->mailer = Swift_Mailer::newInstance($this->getTransport());
if ($this->logging===true) {
$this->logger = new Swift_Plugins_Loggers_ArrayLogger();
$this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger));
}
return $this->mailer;
}