php - Laravel 4 form data submit and update the database and also send an email with the help of post data -
i have form 3 text fields , have submit form can retrieve form post data , send mail recipients. need store post value in variable , can use these variables update database , sending email data.
i'm getting error
symfony \ component \ httpkernel \ exception \ methodnotallowedhttpexception
routes.php:
<?php route::get('mail,new',array('as' => 'new_mail' , 'uses' => 'sendmail@new' )); route::post('formtest/submit','sendmail@create'); route::get('sendmail', function(){ $data = array('detail' => 'email' ); $body = 'body here'; $recipients = 'abc@a.com,def@xyz.com'; $subject = 'test mail'; $date = new datetime(); $d = $date->format('u = y-m-d h:i:s'); mail::queue('emails.sendmail', $data, function($message) { $message->to('abc@ymail.com', 'pradeep g')->subject('test --mail'); }); db::table('sentmail')->insert( array('recipients' => $recipients, 'subject' => $subject, 'body'=>$body, 'created_at'=> $d, 'updated_at'=> $d ) ); return view::make('emails.sent'); });
here files
routes.php http://paste.laravel.com/luo
controller: controllers/sendmail.php http://paste.laravel.com/lun
views/home/ftest.blade.php http://paste.laravel.com/lum
model : models/sendmail.php http://paste.laravel.com/luq
think fixed have typo in controller. in last line says:
return veiw::make('home.sendmail');
where veiw
should view
.
Comments
Post a Comment