In Laravel I use twig templating engine, through TwigBridge, everything works fine, but I can’t send emails, I don’t understand what the problem is.
// In the controller
use AppMailAdminNotification;
Mail::to('[email protected]')->send(new AdminNotification($text));
// I'm sending it in mail class
use TwigBridgeFacadeTwig;
class AdminNotification extends Mailable
{
use Queueable, SerializesModels;
public $data;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data)
{
$this->data = $data;
}
/**
* Subject
*
* @return IlluminateMailMailablesEnvelope
*/
public function envelope()
{
// $this->setUp(config('mailer.mailer_dsn'));
return new Envelope(
from: new Address('bla@bla', 'company'),
subject: ' !!!! bla',
);
}
/**
* Template
*
* @return IlluminateMailMailablesContent
*/
public function content()
{
return new Content(
view: Twig::render('email/notification', ['text' => $this->data])
);
}
/**
* Files
*
* @return array
*/
public function attachments()
{
return [];
}
}
not found. {“url”:”/robot/weekly_report”,”exception”:”[object] (InvalidArgumentException(code: 0):