550 Bad HELO - Host impersonating domain name Laravel

你离开我真会死。 提交于 2021-01-20 07:19:07

问题


I'm trying to setup Laravel auth including the 'Password Reset' function. But I am stumbeling upon a error when I try to send the email. The error I get is:

Expected response code 250 but got code "550", with message "550 Bad HELO - Host impersonating domain name 

Im using Laravel 5.6 with Cloudflare. My hosting said that that might be the issue but I've already tried to disable all Cloudflare DNS functions inside the Cloudflare Dashboard, but that didnt work. I am sure I am using the correct mails settings since they work fine on my phone and any other devices. Also, I've tried switching ports and it doesnt matter if I fill in a valid port or not, it will keep giving me this error.


回答1:


Laravel 5.6 uses $_SERVER["SERVER_NAME"] as your local domain. You should change localdomain to your MAIL_HOST

This worked for me:

config/mail.php

'localdomain' => env('MAIL_HOST')

And you should make a little change in vendor: vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php

    //->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? trim($_SERVER['SERVER_NAME'], '[]') : '127.0.0.1')
    ->asValue(config('mail.localdomain'))

Replace commented code,

I Know this is the worst solution but it seems that there is no other solution.




回答2:


I ran against the same problem and i tried the above answer but it did not help me, but the following worked for me for strange reasons...

In your /config/mail.php add the following line:

'localdomain' => 'localhost'

don't ask me why xD



来源:https://stackoverflow.com/questions/55279922/550-bad-helo-host-impersonating-domain-name-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!