Revision: 206
http://sourceforge.net/p/beeframework/code/206
Author: m_plomer
Date: 2014-09-03 10:48:57 +0000 (Wed, 03 Sep 2014)
Log Message:
-----------
- SmartyMailer: added mail logging function
Modified Paths:
--------------
trunk/framework/Bee/Utils/SmartyMailer.php
Modified: trunk/framework/Bee/Utils/SmartyMailer.php
===================================================================
--- trunk/framework/Bee/Utils/SmartyMailer.php 2014-08-30 15:50:47 UTC (rev 205)
+++ trunk/framework/Bee/Utils/SmartyMailer.php 2014-09-03 10:48:57 UTC (rev 206)
@@ -30,13 +30,21 @@
*/
private $smarty;
- /**
- * @param $subjectTemplate
- * @param $bodyTemplate
- * @param array $model
- * @param mixed $recipient Either string ex...@ma... or array with keys "address" and optional "name"
- * @param mixed $sender Either string ex...@ma... or array with keys "address" and optional "name"
- */
+ /**
+ * @var string
+ */
+ private $messageLogFile;
+
+ /**
+ * @param $subjectTemplate
+ * @param $bodyTemplate
+ * @param array $model
+ * @param mixed $recipient Either string ex...@ma... or array with keys "address" and optional "name"
+ * @param mixed $sender Either string ex...@ma... or array with keys "address" and optional "name"
+ * @throws Exception
+ * @throws phpmailerException
+ * @return bool
+ */
public function sendMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) {
$phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender);
@@ -46,6 +54,20 @@
return true;
}
+ /**
+ * @param $subjectTemplate
+ * @param $bodyTemplate
+ * @param array $model
+ * @param null $recipient
+ * @param null $sender
+ */
+ public function logMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) {
+ $phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender);
+ if($this->messageLogFile && $phpMailer->preSend()) {
+ file_put_contents($this->messageLogFile, $phpMailer->getMailMIME());
+ }
+ }
+
/**
* @param $subjectTemplate
* @param $bodyTemplate
@@ -136,4 +158,18 @@
public final function setSmarty(Smarty $smarty) {
$this->smarty = $smarty;
}
+
+ /**
+ * @return string
+ */
+ public function getMessageLogFile() {
+ return $this->messageLogFile;
+ }
+
+ /**
+ * @param string $messageLogFile
+ */
+ public function setMessageLogFile($messageLogFile) {
+ $this->messageLogFile = $messageLogFile;
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|