Support the ongoing development of Laravel.io →
posted 9 years ago
Mail
Last updated 2 years ago.
0

I've tried adding $data to the function set as the 3rd parameter which hasn't helped

Mail::queue(array('text' => 'emails.plaintext'), $data, function($message, $data)
{
        $message->from('[email protected]', 'My Name');

        $message->to($data['email'])->subject('Email Subject');
});

I've also tried defining a new variable for the email which hasn't worked either

$email = $data['email'];

Mail::queue(array('text' => 'emails.plaintext'), $data, function($message)
{
        $message->from('[email protected]', 'My Name');

        $message->to($email)->subject('Email Subject');
});
Last updated 9 years ago.
0

Try with function($message) use ($data), that should do it.

0

You, Sir, are a rockstar. That did the trick. Thanks.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

VenomRush venomrush Joined 27 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.