Improvements to mailer classes

This commit is contained in:
Sam Georges 2014-07-04 18:14:09 +10:00
parent 5f8aec26a5
commit 2f3d42a3f9
3 changed files with 9 additions and 5 deletions

View File

@ -266,7 +266,6 @@ class Form extends WidgetBase
$this->setFormValues($saveData); $this->setFormValues($saveData);
$this->prepareVars(); $this->prepareVars();
/* /*
* If an array of fields is supplied, update specified fields individually. * If an array of fields is supplied, update specified fields individually.
*/ */

View File

@ -108,8 +108,8 @@ class ServiceProvider extends ModuleServiceProvider
/* /*
* Override standard Mailer content with template * Override standard Mailer content with template
*/ */
Event::listen('mailer.register', function() { Event::listen('mailer.register', function($provider, $mailer) {
App::make('mailer')->bindEvent('content.beforeAdd', function($message, $view, $plain, $data){ $mailer->bindEvent('beforeAddContent', function($message, $view, $plain, $data){
if (EmailTemplate::addContentToMailer($message, $view, $data)) if (EmailTemplate::addContentToMailer($message, $view, $data))
return false; return false;
}); });

View File

@ -60,8 +60,13 @@ class EmailTemplates extends Controller
$model = $this->formFindModelObject($recordId); $model = $this->formFindModelObject($recordId);
$user = BackendAuth::getUser(); $user = BackendAuth::getUser();
Mail::send($model->code, [], function($message) use ($user) { $vars = [
$message->to($user->email, $user->full_name); 'email' => $user->email,
'name' => $user->full_name,
];
Mail::send($model->code, [], function($message) use ($vars) {
extract($vars);
$message->to($email, $name);
}); });
Flash::success('The test message has been successfully sent.'); Flash::success('The test message has been successfully sent.');