codebitz / yomail
在 Laravel 上轻松本地调试邮件
dev-master
2022-05-07 09:38 UTC
Requires
- php: ^7.4|^8.0
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-07 14:37:08 UTC
README
YoMail 是一个 Laravel 扩展包,为 Laravel 应用程序发送的邮件提供实时收件箱。使用它,您可以查看
- 邮件的 HTML 预览。
- 邮件的元数据(收件人、发件人、抄送、密送等)
- 邮件源代码预览。
- 附件。
观看视频了解更多信息。
简介
安装
composer require codebitz/yomail
如何使用
下载完包后,运行 artisan 命令
php artisan yomail:install
这将完成以下三件事
- 运行包的迁移。
- 将资产(JS,CSS)复制到公共目录
/vendor/yomail
。 - 创建
yomail.php
配置文件。
安装完成后,您可以访问项目域名后跟 /yomail
,例如 example.local/yomail
。在这里,您将看到 YoMail 界面。
设置
以下是 YoMail 的可选设置,您可以将其添加到 .env
文件中。以下是设置及其默认值。
# The default route for the inbox ie example.local/yomail YOMAIL_ROUTE=yomail # How often the inbox will check for new emails (in milliseconds) YOMAIL_REFRESH=1000 # If YoMail should be enabled or not YOMAIL_ENABLED=true
授权
默认情况下,YoMail 在非生产环境中不需要任何授权。要在生产环境中使用,您需要在 AuthServiceProvider 中添加一个门控。
public function boot() { // Restrict acccess to the emails in the array Gate::define("view-yomail", function ($user) { return in_array($user->email, [ 'test@example.com', ]); }); // Allow access to all users Gate::define("view-yomail", function ($user) { return true; }); }
支持
⭐ 如果您喜欢这个包,请在 Github 上给它一个星标 YoMail
⚡ 您还可以在 Twitter 上关注我 @aaronlumsden