Search code examples
phplaravelemaillaravel-artisantinker

Can't see email configuration on artisan tinker


I have already set my email configuration on .env file but when i check from tinker is shows null value.

enter image description here

here is my env config

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=c57xxxx07f1
MAIL_PASSWORD=44****02fae
MAIL_ENCRYPTION=tls

i cant send email any solution for this ??


Solution

  • Try to find your config/mail.php

    And put your env key inside.

    env('MAIL_HOST', 'smtp.mailgun.org')
    

    First argument is your env key, second arg is the default value.

    return [
        'driver' => env('MAIL_DRIVER', 'smtp'),
        'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
        ...
    

    And clear config cache:

    php artisan config:clear
    php artisan optimize