File: D:/HostingSpaces/SBogers10/topswtw.komma.pro/app/KommaApp/Shop/Mailers/Mailer.php
<?php
namespace KommaApp\Shop\Mailers;
use \Illuminate\Mail\Mailer as Mail;
class Mailer
{
/**
* @var Mail
*/
protected $mail;
protected $name = null;
protected $address = null;
/**
* @param Mail $mail
*/
public function __construct(Mail $mail)
{
$this->mail = $mail;
}
public function sendTo($email, $subject, $view, $data = [], $attachment = null, $attachmentName = 'invoice.pdf', $replyEmail = null, $replyName = null)
{
// echo 'We are back soon. Sorry for the inconvenience. Please contact us at 085 - 041 08 00 or info@topswtwfilters.nl';
// dd('email '.$email.' subject: '.$subject. 'reply to: '.$replyEmail);
$this->mail->alwaysFrom($this->address, $this->name);
return $this->mail->queue($view, $data, function ($message) use (
$email,
$subject,
$attachment,
$attachmentName,
$replyEmail,
$replyName
) {
$message->to($email)->subject($subject);
if ($replyEmail && $replyName) {
$message->replyTo($replyEmail, $replyName);
}
if ($attachment) {
$message->attach($attachment, ['as' => $attachmentName]);
}
});
}
public function setFrom($address, $name){
$this->name = $name;
$this->address = $address;
}
}