Sending Email Via Gmail SMTP Server In Laravel


Are you looking for using Gmail SMTP server for sending email in Laravel? Sometimes PHP default mail() functions do not send emails due to some server settings or configurations. In such case, we can use SMTP server for sending emails. In this video, we show how to send email using Gmail SMTP server in Laravel.

One more benefit of using SMTP server is, you can send email from your local server also. By this way, it will helpful for us to test the email functionality on local server itself.

Please watch: “How To Add Two Step Authentication On WordPress Website”




  1. This worked on localhost but in serve I earn this erorr:

    Connection could not be established with host [Network is unreachable #101]

  2. i had this problem InvalidArgumentException

    View [emails.mail] not found. but for the folder views i verified the path for the mail.blade.php and its correct???

  3. Wao, This is Great, It works for me in my project. Sir, Please Am having issues with invoice Logo not showing in the mail received. it only showing it alt property name. but the real image of the logo is not showing. Please help me on this.

  4. Add the following code into app/Providers/AppServiceProvider.php:

    public function register()
    $this->app->singleton('mailer', function ($app) {
    return $app->loadComponent('mail', 'IlluminateMailMailServiceProvider', 'mailer');

  5. Still Not working
    I have laravel version 5.4 and getting error

    (1/1) Swift_TransportException
    Connection could not be established with host [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    Can you please help me with this ?

    Thank you.


Please enter your comment!
Please enter your name here