laravel 4 - is it possible to email a particular piece of data from database without using view? -


here controller method:

contact::create([                        'name' => input::get('name'),                        'email' => input::get('email'),                        'confirmation_code' => $confirmation_code                 ]);                   mail::send('blank', array('msg' =>'welcome {{$name}}','name'=>input::get('name'),'confirmation_code' => $confirmation_code), function($message){                     $message->to(input::get('email'), input::get('name'))->subject(' ');                 }); 

here blank view:

<!doctype html> <html lang="en-us">     <head>         <meta charset="utf-8">     </head>     <body>         <p>             {{ $msg }}         </p>     </body> </html>  

the email sent successfully. body 'welcome {{$name}}'. value of {{$name}} not sent email. how fetch value of $name?

you cant have blade variables within other variables - doesnt work way.

you need change code this:

mail::send('blank', array('msg' =>'welcome '.e(input::get('name')),'name'=>input::get('name'),'confirmation_code' => $confirmation_code), function($message){                     $message->to(input::get('email'), input::get('name'))->subject(' ');                 }); 

or better yet - handle message inside view file itself, rather passing via variable.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -