Emails works fine with dummy data:
Mail::send('emails.contact', $messageData, function ($message) use ($messageData) {
$message->from('joetannorella@gmail.com', 'Joe');
$message->to('joetannorella@gmail.com','Joe T')->subject('Email Test');
});
But when I try to pass data into the email, it won't send. I know a common problem is not passing through data with the use ($data), but I am doing this and it's still not working.
This is my code that will not work:
$messageData = array(
'name' => 'test name',
'email' => 'test email',
'message' => 'test message'
);
Mail::send('emails.contact', $messageData, function ($message) Use ($messageData) {
$message->from($messageData['email'], $messageData['name']);
$message->to('joetannorella@gmail.com','Joe T')->subject('Email Test');
});
I'm pretty stuck for ideas now!
Thanks
You cannot use
$message
as your variable - see L4 docs here.So change it to something like "msg" - i.e.: