邮件发送 – 永夜 https://www.shuijingwanwq.com 没有不值得去解决的问题,也没有不值得去学习的技术! Thu, 07 Sep 2023 01:29:03 +0000 zh-Hans hourly 1 https://wordpress.org/?v=7.0 在 Mailtrap 中配置域名以在开发与测试环境中使用邮件发送 https://www.shuijingwanwq.com/2023/09/07/8027/ https://www.shuijingwanwq.com/2023/09/07/8027/#respond Thu, 07 Sep 2023 01:29:03 +0000 https://www.shuijingwanwq.com/?p=8027 浏览量: 52

1、Email Testing Test Emails on Staging。点击 Start Testing。如图1

Email Testing Test Emails on Staging。点击 Start Testing

图1

2、点击 Show Credentials,显示相应的凭证。然后可将相应的凭证复制到开发环境的配置中。如图2

点击 Show Credentials,显示相应的凭证。然后可将相应的凭证复制到开发环境的配置中

图2

3、复制 cURL 中的示例代码,然后在 Linux 终端中粘贴,以测试邮件的发送。如图3

复制 cURL 中的示例代码,然后在 Linux 终端中粘贴,以测试邮件的发送

图3

4、然后在发件箱中可看见已经收到了一封邮件。如图4

然后在发件箱中可看见已经收到了一封邮件

图4

5、在开发环境中使用邮件发送。最后在 发件箱 中可以查看已经发送的邮件内容。如图5

在开发环境中使用邮件发送。最后在 发件箱 中可以查看已经发送的邮件内容

图5

]]>
https://www.shuijingwanwq.com/2023/09/07/8027/feed/ 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