mercredi 31 août 2016

Use php variables in Laravel to send mail

I mates,I have this code in my Controller:

             $name      =   Input::get('fname')." " .Input::get('lname');
             $message   =   Input::get('message');
             $email     =   Input::get('email');
             $subject   =   Input::get('subject');
             $phone     =   Input::get('phone');
             $area      =   \App\Area::find(1)->name;
             $ticket    =   \App\Area::find(1)->ticket_sent;
             Mail::send('help.send', [ 'Mmessage' => $message, 'Mname' => $name, 'Memail' => $email, 'Msubject' => $subject, 'Mphone' =>$phone, 'Marea' => $area, 'Mticket' => $ticket], function ($message)
             {

                $message->from('asd@gmail.com', 'Name');*

                $message->to('support@mycompany.it');

                $message->subject('Support');

             });
             $macroArea = MacroArea::find(1);
             $macroArea->ticket_sent =$ticket+1;
             $macroArea->save();
            Session::flash('message', 'The message was successfully send. We will get back to you within 2 business days!');
            return Redirect::to('helpDesk');

It works so good, but I'm trying to change two rows in:

                $message->from($email, $name);

                $message->subject($subject);

But it doesn't work. What am I doing wrong? I don't understand.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire