HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtwmobile.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);
        $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;
    }
}