Send mail from a local machine using laravel

I want to send mail from my local machine using laravel 5.4 in the password API for forgetting. But I get Swift_TransportException

(1/1) Swift_TransportException
Expected response code 220 but got code "502", with message "502 Command not implemented
"


Details .env -

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=username@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=username@gmail.com
MAIL_FROM_NAME=Project.com


The code I get is

$response = $this->broker()->sendResetLink(
      $request->only('email')
);


The code in config / mail.php is in

return [
    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
    'port' => env('MAIL_PORT', 587),
    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'markdown' => [
        'theme' => 'default',

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

How to enable mailing from my local machine? Should I enable the port for this?

+7
source share
3 answers

fakesmtp http://nilhcem.com/FakeSMTP/ localhost : 25 . - . , , fakesmtp.

0

:

mailtrap.io . , laravel . .

!

0

.env , .

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=useraddress@gmail.com
MAIL_PASSWORD=userpassword
MAIL_ENCRYPTION=ssl

config/mail.php :

'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],
    'stream' => [
        'ssl' => [
            'allow_self_signed' => true,
            'verify_peer' => false,
            'verify_peer_name' => false
        ]
    ]

ps: useraddress@gmail.com,

0
source

All Articles