Setting up Gmail



  • Hello team, I am trying to set up an email (Gmail) however I am having an issue.
    My email configuration is like this in the .env file
    MAIL_DRIVER=SMTP
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=465
    [email protected]
    MAIL_PASSWORD=test
    MAIL_ENCRYPTION=SSL

    I get an error when I run the following command

    php artisan config:cache
    Configuration cache cleared!
    
    In LoadConfiguration.php line 49:
    
      date_default_timezone_set(): Timezone ID '' is invalid
    

    My timezone is set to APP_TIMEZONE=EDT in my .env file

    and when I try to send an email, I get the following error

    Error! Connection could not be established with host smtp.site.com :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known.
    

    I have also turned on less secure app access;

    Can you please guide what I am missing?
    thanks



  • Hi @sajanojha,

    Try to do these things,

    • Run php artisan cache:clear.
    • Run php artisan config:clear.

    If possible restart your web server.



  • @devansh-webkul said in Setting up Gmail:

    php artisan config:clear

    didn't work what you suggested, I was able to configure it.


Log in to reply