Google Gmail SMTP

Posted 4 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.

Reply to

Use Markdown with GitHub-flavored code blocks.