简体   繁体   中英

Geting an error of 220 in laravel for mail function

In my laravel project i configured a mail file and env as below. and getting an error Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 220 but got code "502", with message "502 Command not implemented "

mail.php file

<?php

return [
    'driver' => env('MAIL_DRIVER'),
    'host' => env('MAIL_HOST'),
    'port' => env('MAIL_PORT', 587), 
    'from' => [
        'address' => 'alfiza@adaptit.co.uk',
        'name' => 'oData',
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',
    'stream' => [
        'ssl' => [
            'allow_self_signed' => true,
            'verify_peer' => false,
            'verify_peer_name' => false,
        ],
    ],

];

.env file

APP_ENV=local
APP_KEY=base64:FB3usUpI/uPm6VLzx2yR0xHcE61ZxHU6MC6QCBk6wHE=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

OCONNECT_URL=http://localhost:8001/
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=odata_demo2
DB_USERNAME=root
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls

Do I required to add any extentions in my ini? In my another desktop system it's working very well.But when I get in my laptop it showing an error of 220 in sending email.I also found this same question here (in stackover flo not working for me.Please help.Thanks in advance.

You are using an encryption MAIL_ENCRYPTION=tls which is not enabled on your localhost.

Use MAIL_ENCRYPTION=null in the env file for localhost, or enable it (tls) for your localhost if gmail requires it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM