Laravel sending email issue Swift_TransportException

164 Views Asked by At

I am using Laravel 8. Trying to implement email notification and facing the below issue repeatedly. I have tried and changed the env file and mail.php file as suggested in different portals yet no luck.

Error: Swift_TransportException

Expected response code 250 but got code "530", with message "530 Error: authentication Required " http://localhost:8000/forgot-password

env file:

MAIL_DRIVER=smtp
MAIL_MAILER=smtp
MAIL_HOST=smtp-pulse.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=5mbE7LbBtcJc
MAIL_ENCRYPTION=TLS
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

mail.php

<?php

return [

'default' => env('MAIL_MAILER', 'smtp'),
    'mailers' => [
        'smtp' => [
            'transport' => 'smtp',
            'host' => env('MAIL_HOST', 'smtp-pulse.com'),
            'port' => env('MAIL_PORT', 587),
            'encryption' => env('MAIL_ENCRYPTION', 'TLS'),
            'username' => env('[email protected]'),
            'password' => env('5mbE7LbBtcJc'),
            'timeout' => null,
            'auth_mode' => null,
        ],
       'ses' => [
            'transport' => 'ses',
        ],

        'mailgun' => [
            'transport' => 'mailgun',
        ],

        'postmark' => [
            'transport' => 'postmark',
        ],

        'sendmail' => [
            'transport' => 'sendmail',
            'path' => '/usr/sbin/sendmail -bs',
        ],

        'log' => [
            'transport' => 'log',
            'channel' => env('MAIL_LOG_CHANNEL'),
        ],

        'array' => [
            'transport' => 'array',
        ],
    ],
    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Company name'),
    ],
    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],
];
1

There are 1 best solutions below

1
Abdulla Nilam On BEST ANSWER

config should be liike this

In your code

'username' => env('[email protected]'),
'password' => env('5mbE7LbBtcJc'),

should be

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