php - Laravel 4 Email : I can't get emails -
i have written code sending emails
route::post('contact', function(){ $inputs = input::all(); $rules = array( 'email' => 'required|email', 'name' => 'required|min:2', 'message' => 'required', 'recaptcha_response_field' => 'required|recaptcha', ); $validator = validator::make($inputs, $rules);
if($validator->passes()){
$fromemail = input::get('email'); $fromname = input::get('name'); $subject = input::get('subject'); $data = array('message' => input::get('message')); $toemail = 'info@danielchikaka.com'; $toname = 'daniel chikaka'; mail::send('emails.contact', $data, function($message) use ($toemail, $toname, $fromemail, $fromname, $subject){ $message->to($toemail, $toname)->from($fromemail, $fromname)->subject($subject); }); return redirect::to('/');
}
return redirect::to('/#contact')->withinput()->witherrors($validator);
});
and view emails.contact
<html> <body> <p><b>email from:</b> {{$fromname}} of {{$fromemail}}</p> <p><b>subject:</b> {{$subject}}</p> <b> message:</b> <br> </html> {{$data}} </body>
but whenever send email :
email from:{{$fromname}} of {{$fromemail}} subject: {{$subject}} message: {{$data}
why view not pick data mail class?
make sure view has blade
extension:
views/emails/contact.blade.php
Comments
Post a Comment