我想在遗忘密码API中使用laravel 5.4从本地计算机发送邮件。但是我得到了Swift_TransportException
(1/1) Swift_TransportException
Expected response code 220 but got code "502", with message "502 Command not implemented
"
.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
我收到错误的代码是
$response = $this->broker()->sendResetLink(
$request->only('email')
);
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', 'Example'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
如何从本地计算机启用邮件?我必须为此启用端口吗?
答案 0 :(得分:0)
您可以下载并使用fakesmtp http://nilhcem.com/FakeSMTP/ 对于localhost和set port:默认为25 ..对于任何支持本地服务器机器的框架。 只有当你想发送邮件并检查邮件登录fakesmtp时才需要启动。
答案 1 :(得分:0)
答案 2 :(得分:0)
尝试在<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<div id="target">
</div>
文件中进行此配置,它始终对我有用。
.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
ps:您需要配置useraddress@gmail.com帐户,以允许安全性较低的应用程序使用它