/api/v1/events – 永夜 https://www.shuijingwanwq.com 没有不值得去解决的问题,也没有不值得去学习的技术! Mon, 17 Jan 2022 01:30:31 +0000 zh-Hans hourly 1 https://wordpress.org/?v=7.0 在 Windows 10 宿主机中运行 MailHog ,方便我们开发 Laravel 时对邮件发送的监控 https://www.shuijingwanwq.com/2022/01/17/5715/ https://www.shuijingwanwq.com/2022/01/17/5715/#respond Mon, 17 Jan 2022 01:30:31 +0000 https://www.shuijingwanwq.com/?p=5715 浏览量: 333 1、在 Windows 10 中安装 MailHog ,方便我们开发 Laravel 时对邮件发送的监控。原因在于开发环境是本地主机环境,并非 Homestead 或者 Docker 。打开网址:https://github.com/mailhog/MailHog 。 2、选择 MailHog_windows_amd64.exe ,如图1
选择 MailHog_windows_amd64.exe

图1

3、运行下载的文件后,界面,如图2
运行下载的文件后,界面

图2



[APIv1] BROADCAST /api/v1/events
2021/12/31 11:20:12 [SMTP 127.0.0.1:64569] Session ended
[APIv2] GET /api/v2/jim
[APIv2] GET /api/v2/messages
[APIv2] GET /api/v2/websocket
[APIv1] KEEPALIVE /api/v1/events
[APIv1] GET /api/v1/messages/9u2mG73gOYyJTHv5yUKHcTGqLrdsdsvzl88MrKPxBlw=@mailhog.example

[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events
[APIv1] KEEPALIVE /api/v1/events


4、在浏览器中打开网址:http://larabbs.local:8025/ 。如图3
在浏览器中打开网址:http://larabbs.local:8025/

图3

5、Laravel 的 .env 文件中修改 Email 相关设置如下来开启 MailHog


MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=admin@larabbs.local
MAIL_FROM_NAME="${APP_NAME}"


6、接下来浏览器访问 larabbs.local/register ,填写表单并注册一个测试用户。注册成功后,访问 larabbs.local:8025/ 查看 MailHog 。可见邮件成功发送。如图4
访问 larabbs.local:8025/ 查看 MailHog 。可见邮件成功发送。

图4

]]>
https://www.shuijingwanwq.com/2022/01/17/5715/feed/ 0