Google Gmail SMTP

Posted 2 months ago by hjortur17

Hi, I'm trying to use Google Gmail SMTP to receive an ‚Äčemail from my site, but I when I try to send email from the form I get 500 error. Can anybody help me figure this out :)

The .env file:

[email protected]

The ContactController

public function store(Request $request)
        $this->validate(request(), [
                     'name' => 'required',
                     'email' => 'required|email',
                     'message' => 'required|min:20'

              $data = array(
                'name' => request('name'),
                'email' => request('email'),
                'website' => request('website'),
                'bodyMessage' => request('message')

              Mail::send('', $data, function ($message) use ($data) {
                $message->to('[email protected]');
                $message->subject('New message from contact form');

        return back()
                     ->with('flash', 'I will here from you soon!');

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.