no idea why this is happening.
Heres a basic code I am testing:
<?php
// get each user and send an email
$query = DB::table('users')->where('email', '[email protected]')->get();
foreach ($query as $user) {
$email = $user->email;
$data = array();
Mail::send('emails.wereback', $data, function($message)
{
$message->from('[email protected]', 'BuildSanctuary');
$message->to($email);
$message->subject("We are back online!");
});
}
?>
This is giving me an error of undefined variable '$email'.
The problem is, if I dont try to send an email and instead just echo out the $email variable it works perfectly fine...