小编Nei*_*ney的帖子

使用Laravel(Localhost)通过表单将文件发送到电子邮件

拉拉维尔的新手很善良哈哈

我对mail.php的配置是正确的,并且正在成功接收电子邮件以便将文本输入到gmail,但不确定如何完成文件的任务.我将不胜感激一些帮助或参考链接.

提前致谢!!

routes.php中的代码

Route::get('/', function()
{
return View::make('form');
});

Route::post('/form', function()
{
        $data = ['firstname' => Input::get('firstname'), 'username' =>        Input::get('username'), 'email' => Input::get('email'), 'resume' => Input::get('resume') ];

        $rules = array(
            'username' => 'Required|Min:7',
            'email'     => 'Required|Email',
            'firstname' => 'Required',
            'resume' => 'Required'
        );


        $validation = Validator::make(Input::all(), $rules);

        if ($validation->fails())
        {
            // Validation has failed.
            return Redirect::to('/')->withInput()->withErrors($validation);
        }

        else {

            Mail::send('emails.welcome', $data, function($message)
        {
            $message->to('mail@domain.net');
            $message->subject('Welcome to Laravel');
            $message->from('sender@domain.net');


        });

        return Redirect::to('/')->withInput()->with('success', 'Thank you for your submission.');

        }
//
}); …
Run Code Online (Sandbox Code Playgroud)

php email file-upload localhost laravel

5
推荐指数
1
解决办法
9145
查看次数

标签 统计

email ×1

file-upload ×1

laravel ×1

localhost ×1

php ×1