Laravel 5.4 Mailables, replyTo, subject, cc, bcc build. to, .
, :
to Mail, :
Mail::send(new ContactCompany($attributes));
replyTo build:
class ContactCompany extends Mailable
{
use Queueable, SerializesModels;
public $attributes;
public function __construct($attributes)
{
$this->attributes = $attributes;
}
public function build()
{
$this->to($this->attributes['departmentEmail'], config('app.name'));
$this->replyTo($this->attributes['email'], $this->attributes['name']);
$this->subject(sprintf("New contact message from %s", $this->attributes['name']));
return $this->markdown('emails.contact.company');
}
}
, , Mail::alwaysFrom() Mail::alwaysReplyTo() Mail::send(), from replyTo , .