Recent Topics

Send form contact us



  • Hello, I want to send my logic form in email but route post will be 404
    My logic

    class ContactController extends Controller
    {
        public function send(Request $request) {
            $this->validate($request, [
                'name' => 'required',
                'email' => 'required|email',
                'phone' => 'required|numeric',
                'message' => 'required'
            ]);
    
            Mail::send('email', [
                'name' => $request->get('name'),
                'email' => $request->get('email'),
                'phone' => $request->get('phone'),
                'message' => $request->get('message') ],
                function ($message) {
                        $message->from('[email protected]_domain');
                        $message->to('[email protected]_domain', 'Your Name')
                                ->subject('Your Website Contact Form');
            });
    
            return back()->with('success', 'Thanks for contacting me, I will get back to you soon!');
        }
    }
    
    

    and form is created in cms bagisto
    What is wrong?



  • Hi,

    Is your route working properly? have you registered you route for post request ? please try after clearing routes cache by executing the command:- php artisan route:cache



  • Hi @DaniD,

    You need to create the route for the POST method. Please register your route so that you can send the request.



  • I write in PagePresenterController.php

    public function send(Request $request) {
            $this->validate($request, [
                'name' => 'required',
                'email' => 'required|email',
                'phone' => 'required|numeric',
                'message' => 'required'
            ]);
    
            Mail::send('email', [
                'name' => $request->get('name'),
                'email' => $request->get('email'),
                'phone' => $request->get('phone'),
                'message' => $request->get('message') ],
                function ($message) {
                        $message->from('[email protected]_domain');
                        $message->to('[email protected]_domain', 'Your Name')
                                ->subject('Your Website Contact Form');
            });
            return back()->with('success', 'Thanks for contacting me, I will get back to you soon!');
        }
    

    And route is in routes.php
    Webkul packages -> Shop

    
        Route::get('page/{slug}', 'Webkul\CMS\Http\Controllers\Shop\[email protected]')->name('shop.cms.page');
        Route::post('page/{slug}', 'Webkul\CMS\Http\Controllers\Shop\[email protected]');
    


  • 
    View [mail] not found.
    How can i send mail with bagito?
    I use this from a laravel project personal
    




  • Hi @DaniD,

    I have checked your code, does the email view exist in your code?

    Mail::send('email', [ // doest this view present in your code
    ...
    

Log in to reply