nam_co
202
5
Laravel

Getting the $to data inside the mailable

Posted 2 years ago by nam_co

Hi, hope somebody can help me, is there a way to get the $to email address from inside the Mailable file with out passing it from the controller?

Something like: public function __construct() { $this->email = $to;

in case this is not possible, is there a way to append additional data to a Mailable, example:

$message = (new SendEmail($biz))->onConnection('sync'); Then: Mail::to($row)->queue($message, ['email' => $row]); //adding the email to the data

Appreciate any help

Please sign in or create an account to participate in this conversation.