Send Mail

Hello, I am trying to config my contact form to send email using google smtp but no email received.

The .env is like below: MAIL_DRIVER=mail


[email protected]



the code at controller is like:

try {

        Mail::send('email.newEmail', $data, function ($message){

            $message->to('[email protected]', 'myEmail')

                ->subject('New email from your website');

            $message->from('[email protected] ', 'xyz');


        return view('contact-us', ['msg' => 'Email was sent successfully! We will contact you as soon as possible.', 'msgSuccess' => true]);

    }catch (Exception $ex) {

        return view('contact-us', ['msg' => 'Email failed to send, please try again later !', 'msgSuccess' => false]);


and it shows that email was sent successfully but no email archive at my inbox(or spam).

I have try to change host and the email is ok(and when i try from localhost it's ok).

I am hosting my site on VPS(contabo, operating system: Ubuntu 16.04)

Can someone help me?

Thank you

MPeter replied 1 year ago

Hello andixhafa!

If email is sent properly and working on localhost, probably you have problems with google settings.

Check these settings in your gmail account:

  1. 2step verification is enabled?
  2. in your gmail, sometimes there will come message that someone connected and was rejected, so u need to allow that

I hope that problem is there and will be solved soon :)

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us