Connection could not be established with host mailtrap.io [php_network_getaddresses: getaddrinfo failed: No such host is known. #0]

后端 未结 8 1746
予麋鹿
予麋鹿 2020-12-19 02:07

I am getting below error:

Connection could not be established with host smtp.gmail.com [php_network_getaddresses: getaddrinfo failed: No such host is kno

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 02:35

    Edit and following this file: config / mail.php

    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'your mail host'),
    'port' => env('MAIL_PORT', '465'),
    'from' => [
            'address' => env('MAIL_FROM_ADDRESS', 'Your email address'),
            'name' => env('MAIL_FROM_NAME', 'Your email Name'),
    'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
    

    Don't touch for these two lines

    'username' => env('MAIL_USERNAME'),
    
    'password' => env('MAIL_PASSWORD'),
    

    Edit and following this file: /.env

    MAIL_DRIVER=smtp
    MAIL_HOST=your mail host
    MAIL_PORT=465
    MAIL_USERNAME=Your smtp email address
    MAIL_PASSWORD=Your smtp password
    MAIL_ENCRYPTION=ssl
    
    MAIL_FROM_ADDRESS=Your email address
    MAIL_FROM_NAME="Your email Name"
    

    Use below artisan command.

    Clear cache using artisan command

    php artisan config:clear

    Clear config

    php artisan cache:clear

    Restart your server

    sudo service httpd restart

    It will be works! Enjoy your coding

提交回复
热议问题