How to configure Laravel mail.php to use built-in mail function?

后端 未结 4 1279
花落未央
花落未央 2020-12-13 07:25

I need to send an email via the mail() PHP function. I\'ve read somewhere that I have to change driver parameter in config/mail.php to

4条回答
  •  鱼传尺愫
    2020-12-13 08:16

    You can set your mail configuration .env file like

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=587
    MAIL_USERNAME=youremail@gmail.com
    MAIL_PASSWORD="password"
    MAIL_ENCRYPTION=tls
    

    also set configuration in config/mail.php like:

    'from' => ['address' => 'youremail@gmail.com', 'name' => 'Test'],

    then you can clear the cache:

    php artisan cache:clear
    php artisan config:cache
    php artisan cache:clear
    

提交回复
热议问题