Pass message body from form to email? Email working, but no message body :(

Posted 2 years ago by rafalmietkiewicz

Hey, I'm in a little trouble. I've set up the swift mailer, the message is being sent correctly, but for the heck of god I can't pass the message body... Please help me pass $data -> message to my template 'welcome-email'... Here is my controller:

public function Kontakt(Request $request) {

$data = $request->all();

    $mail = Mail::send('welcome-email', array('data' => $data), function ($message) use ($data) {

        $message->subject('Zapytanie o pomoc psychologiczną');

        $message->from($data['email'] , $data['name']); 

        //email 'To' field: cahnge this to emails that you want to be notified.
        $message->to('[email protected]', 'Rafał Miętkiewicz');

//Check if mail was successfully sent
if (!$mail)
    return redirect('/screwed_again');

// If everything is successful
return redirect('/yuppie');

//    return Redirect::route('map')->with('message', 'Your message has been sent. Thank You!');


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