2013-12-25 22:34:42 +01:00
|
|
|
<?php namespace ninja\mailers;
|
2013-12-10 18:18:35 +01:00
|
|
|
|
|
|
|
use Mail;
|
|
|
|
|
|
|
|
abstract class Mailer {
|
|
|
|
|
2014-01-07 16:50:41 +01:00
|
|
|
public function sendTo($toEmail, $fromEmail, $subject, $view, $data = [])
|
2013-12-10 18:18:35 +01:00
|
|
|
{
|
|
|
|
$views = [
|
2014-01-08 00:59:06 +01:00
|
|
|
'emails.'.$view.'_html',
|
|
|
|
'emails.'.$view.'_text'
|
2013-12-10 18:18:35 +01:00
|
|
|
];
|
2014-01-08 00:59:06 +01:00
|
|
|
|
2014-02-19 14:28:29 +01:00
|
|
|
$view = 'emails.' . $view;
|
|
|
|
|
|
|
|
Mail::queue($view, $data, function($message) use ($toEmail, $fromEmail, $subject)
|
2014-01-08 00:59:06 +01:00
|
|
|
{
|
2014-01-07 16:50:41 +01:00
|
|
|
$message->to($toEmail)->replyTo($fromEmail)->subject($subject);
|
2014-01-08 00:59:06 +01:00
|
|
|
});
|
2013-12-10 18:18:35 +01:00
|
|
|
}
|
|
|
|
}
|