File: D:/HostingSpaces/SBogers10/zuiderbos.komma.pro/Komma/Mailers/Mailer.php
<?php
namespace Komma\Mailers;
use Illuminate\Support\Facades\Mail;
class Mailer
{ //class that never will be used on it's own
/**
* This is an wrapper for the Mail facade
* and will sent an email with a view.
*
* @param $to | Address to send to
* @param $subject | Subject of the email
* @param $view | The view that is send
* @param array $data
*/
public function sendTo($to, $subject, $view, $data = [], $cc = [])
{
/**
* Send a new message using a view.
*
* @param string|array $view
* @param array $data
* @param \Closure|string $callback calls callMessageBuilder
* @return void
*/
Mail::send($view, $data, function ($message) use ($to, $subject, $data, $cc) {
//Set the mail to
$message->to($to);
if(sizeof($cc) != 0){
$message->cc($cc);
}
//Set the subject
$message = $message->subject($subject);
//If replyTo is set, set this in the header
if (isset($data['replyTo'])) $message = $message->replyTo($data['replyTo'], $data['replyTo']);
});
}
}