dtg7662
dtg7662
2018-06-14 09:55

Laravel在旁边代理网络中发送邮件

已采纳

I am just implementing like password reset system. The Sending Mail system is working in home without the proxy setup. But inside the proxy setup system is not working(both are in localhost). when i upload to the server its working. Then why in the localhost under the proxy setup network system is not working???

It shows the Error

Expected response code 220 but got code "421", with message "421 Cannot connect to SMTP server 74.125.200.109 (74.125.200.109:587), connect error 10060 "

This is my .env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=test@gmail.com
MAIL_PASSWORD=*********
MAIL_ENCRYPTION=tls

my config/mail.php

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', 'MYNAME'),
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',
    'markdown' => [
        'theme' => 'default',
        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],
];

Since i am new to laravel , Is there any setting need to do OR Should i want to configure the proxy name and port number(how to configure the proxy setup in laravel) ... please help me .. thank you in advance

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongzhao1865 dongzhao1865 3年前

    When you want use your gmail account in another apps, You should enable Let less secure apps option

    Also you can define another key for your account ( different that you account password ). You should have a key like this when you are using 2FA

    Don't forget to run php artisan config:cache after any changes in .env file

    点赞 评论 复制链接分享