From 8333a14eb51c04a772367781de28b567b68f6d32 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 9 Nov 2013 23:02:56 -0500 Subject: [PATCH] Added parameters to fileTransportCallback. --- framework/yii/mail/BaseMailer.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/yii/mail/BaseMailer.php b/framework/yii/mail/BaseMailer.php index 4cc5279..6311549 100644 --- a/framework/yii/mail/BaseMailer.php +++ b/framework/yii/mail/BaseMailer.php @@ -81,6 +81,12 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont * @var callback a PHP callback that will be called by [[send()]] when [[useFileTransport]] is true. * The callback should return a file name which will be used to save the email message. * If not set, the file name will be generated based on the current timestamp. + * + * The signature of the callback is: + * + * ~~~ + * function ($mailer, $message) + * ~~~ */ public $fileTransportCallback; @@ -272,7 +278,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont mkdir($path, 0777, true); } if ($this->fileTransportCallback !== null) { - $file = $path . '/' . call_user_func($this->fileTransportCallback); + $file = $path . '/' . call_user_func($this->fileTransportCallback, $this, $message); } else { $time = microtime(true); $file = $path . '/' . date('Ymd-His-', $time) . sprintf('%04d', (int)(($time - (int)$time) * 10000)) . '-' . sprintf('%04d', mt_rand(0, 10000)) . '.txt';