我有一个包含 3 个文本字段的表单,我必须提交该表单,以便我可以检索表单发布数据并将邮件发送给收件人。但是我需要将 post 值存储在变量中,我可以使用这些变量来更新数据库以及发送包含这些数据的电子邮件。
我收到此错误
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
路线.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');
});
这是文件
Routes.php http://paste.laravel.com/LuO
控制器:控制器/Sendmail.php http://paste.laravel.com/LuN
意见/主页/ftest.blade.php http://paste.laravel.com/LuM
型号:models/Sendmail.php http://paste.laravel.com/LuQ