<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SMTPMail extends Mailable
{
    use Queueable, SerializesModels;

    public $body;
    public $messageText;
    protected $subjectLine;
    protected $sender;

    public function __construct($subject, $body, $sender)
    {
        $this->subjectLine = $subject;
        $this->body = $body;
        $this->sender = $sender;
        $this->messageText = $body; 
    }

    public function build()
    {
        return $this->subject($this->subjectLine)
                    ->view('Mailer')
                    ->with(['messageText' => $this->messageText]);
    }

    // use Queueable, SerializesModels;
    // public $body;

    // /**
    //  * Create a new message instance.
    //  *
    //  * @return void
    //  */
    // public function __construct($subject,$body,$sender)
    // {
    //     $this->subject($subject);
    //     $this->body = $body;
    //     $this->from($sender,$subject);
    // }

    // /**
    //  * Build the message.
    //  *
    //  * @return $this
    //  */
    // public function build()
    // {
    //     return $this->view('Mailer');
    // }
}
