Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review #1

Closed
wants to merge 16 commits into from
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/.github export-ignore
/tests export-ignore
/resources/css export-ignore
/resources/js export-ignore
/workbench export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.npmrc export-ignore
/.nvmrc export-ignore
/CHANGELOG.md export-ignore
/eslint.config.mjs export-ignore
/package.json export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/pnpm-lock.yaml export-ignore
/prettier.config.cjs export-ignore
/README.md export-ignore
/testbench.yaml export-ignore
/tsconfig.json export-ignore
/vite.config.js export-ignore
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

66 changes: 0 additions & 66 deletions .github/ISSUE_TEMPLATE/bug.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ yarn-error.log
.DS_Store
/playwright/.auth
/playwright-report
build
/build
composer.lock
coverage
docs
phpunit.xml
phpstan.neon
vendor
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Changelog

All notable changes to `:package_name` will be documented in this file.

## 0.0.3 - 2025-04-03

Fixed gitattributes ignoring views and not including them in the distribution bundle

## 0.0.2 - 2025-03-29

Laravel 12 support

## 0.0.1 - 2025-02-22

Added missing dist files
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# Mail Logger
# Mail Log for Laravel

This is a package built for [Laravel](https://laravel.com/) to log all emails sent from the application. It is built using the following stack:
[![Total Downloads](https://img.shields.io/packagist/dt/gearbox-solutions/mail-log)](https://packagist.org/packages/gearbox-solutions/mail-log)
[![Latest Stable Version](https://img.shields.io/packagist/v/gearbox-solutions/mail-log)](https://packagist.org/packages/gearbox-solutions/mail-log)
[![License](https://img.shields.io/packagist/l/gearbox-solutions/mail-log)](https://github.com/gearbox-solutions/mail-log/blob/2.x/LICENSE)

- [Inertia.js](https://inertiajs.com/)
- [Vue](https://vuejs.org/)
- [PrimeVue](https://primevue.org/)
- [TailwindCSS](https://tailwindcss.com/)
- [Orchestra Testbench](https://packages.tools/testbench)
This is a package built for [Laravel](https://laravel.com/) to log all emails sent from your application.

Mail Log provides a user interface to view all emails which have been sent. The default location is `https://yourapp.com/mail-log`, but can be changed.

The Mail Log UI and routes are separate from the rest of your app. The assets are all precompiled and frontend-agnostic! It should work fine no matter if you're using Blade, Inertia, React, Vue, or any other frontend.

[![An example list view of sent email in the Mail Log package](./docs/images/mail-log-index.webp)](./docs/images/mail-log-index.webp?raw=true)

The package should do the following:
[![An example list view of sent email in the Mail Log package](./docs/images/mail-log-detail.webp)](./docs/images/mail-log-detail.webp?raw=true)

- Provide a migration to create a new `mail_logs` table in the database to store the emails.
- add a listener for the `MessageSending` event. This should save the email to the database.
- add a listener for the `MessageSent` event. This should update the status of the email to sent.
- Provide a controller and routes to handle the display of the emails in the UI.
- Provide an artisan command to delete all logged emails from the database.
- Provide an artisan command to delete all logged emails older than a certain number of days.
## Support

This package is built and maintained by [Gearbox Solutions](https://gearboxgo.com/). We build fantastic web apps with
technologies like Laravel, Vue, React, and Node. If you would like assistance building your own web app, either using
this package or other projects, please [contact us](https://gearboxgo.com/) for a free introductory consultation to
discuss your project.

## Installation

Expand Down Expand Up @@ -76,6 +80,14 @@ By default, this package stores all emails sent by your server in the `mail-logs

## Development

This package is built using the following stack:

- [Inertia.js](https://inertiajs.com/)
- [Vue](https://vuejs.org/)
- [PrimeVue](https://primevue.org/)
- [TailwindCSS](https://tailwindcss.com/)
- [Orchestra Testbench](https://packages.tools/testbench)

Developing this package is done using two local servers. The first is the Testbench Laravel server which is used to serve the app. The second is Vite, which builds the front-end assets.

Run the development Laravel server using
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": "^8.2",
"illuminate/contracts": "^10.0||^11.0",
"illuminate/contracts": "^10.0||^11.0||^12.0",
"inertiajs/inertia-laravel": "^2.0",
"spatie/laravel-package-tools": "^1.16",
"tightenco/ziggy": "^2.5"
Expand Down
2 changes: 1 addition & 1 deletion database/factories/MailLogFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function definition()

return [
'message_id' => $this->faker->uuid,
'sent_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
'from_email' => $this->faker->email,
'from_name' => $this->faker->name,
'to_email' => $to_email,
Expand All @@ -37,7 +38,6 @@ public function definition()
'content_text' => $this->faker->paragraph,
'headers' => $this->faker->randomElement([null, $this->faker->word]),
'mailer' => $this->faker->randomElement([null, $this->faker->word]),
'sent_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
'status' => $this->faker->randomElement(['success', 'failed']),
'error_message' => $this->faker->randomElement([null, $this->faker->sentence]),
'attachments' => $attachments,
Expand Down
1,838 changes: 1,838 additions & 0 deletions dist/build/assets/MailIndex-DVYoo5uZ.js

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions dist/build/assets/MailShow-BdT1JXFW.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import{s as u,d as m,a as f}from"./dayjs.min-NtYHfqg0.js";import{B as p,c as r,o as s,D as h,F as i,C as b,m as c,U as v,a as e,N as t,am as y,L as d,R as k,ap as l}from"./app-aQLUJyJ9.js";var w=function(o){var a=o.dt;return`
.p-tag {
display: inline-flex;
align-items: center;
justify-content: center;
background: `.concat(a("tag.primary.background"),`;
color: `).concat(a("tag.primary.color"),`;
font-size: `).concat(a("tag.font.size"),`;
font-weight: `).concat(a("tag.font.weight"),`;
padding: `).concat(a("tag.padding"),`;
border-radius: `).concat(a("tag.border.radius"),`;
gap: `).concat(a("tag.gap"),`;
}

.p-tag-icon {
font-size: `).concat(a("tag.icon.size"),`;
width: `).concat(a("tag.icon.size"),`;
height:`).concat(a("tag.icon.size"),`;
}

.p-tag-rounded {
border-radius: `).concat(a("tag.rounded.border.radius"),`;
}

.p-tag-success {
background: `).concat(a("tag.success.background"),`;
color: `).concat(a("tag.success.color"),`;
}

.p-tag-info {
background: `).concat(a("tag.info.background"),`;
color: `).concat(a("tag.info.color"),`;
}

.p-tag-warn {
background: `).concat(a("tag.warn.background"),`;
color: `).concat(a("tag.warn.color"),`;
}

.p-tag-danger {
background: `).concat(a("tag.danger.background"),`;
color: `).concat(a("tag.danger.color"),`;
}

.p-tag-secondary {
background: `).concat(a("tag.secondary.background"),`;
color: `).concat(a("tag.secondary.color"),`;
}

.p-tag-contrast {
background: `).concat(a("tag.contrast.background"),`;
color: `).concat(a("tag.contrast.color"),`;
}
`)},$={root:function(o){var a=o.props;return["p-tag p-component",{"p-tag-info":a.severity==="info","p-tag-success":a.severity==="success","p-tag-warn":a.severity==="warn","p-tag-danger":a.severity==="danger","p-tag-secondary":a.severity==="secondary","p-tag-contrast":a.severity==="contrast","p-tag-rounded":a.rounded}]},icon:"p-tag-icon",label:"p-tag-label"},x=p.extend({name:"tag",theme:w,classes:$}),B={name:"BaseTag",extends:u,props:{value:null,severity:null,rounded:Boolean,icon:String},style:x,provide:function(){return{$pcTag:this,$parentInstance:this}}},g={name:"Tag",extends:B,inheritAttrs:!1};function j(n,o,a,I,L,O){return s(),r("span",c({class:n.cx("root")},n.ptmi("root")),[n.$slots.icon?(s(),h(v(n.$slots.icon),c({key:0,class:n.cx("icon")},n.ptm("icon")),null,16,["class"])):n.icon?(s(),r("span",c({key:1,class:[n.cx("icon"),n.icon]},n.ptm("icon")),null,16)):i("",!0),n.value!=null||n.$slots.default?b(n.$slots,"default",{key:2},function(){return[e("span",c({class:n.cx("label")},n.ptm("label")),t(n.value),17)]}):i("",!0)],16)}g.render=j;const z={class:"h-full p-2"},S={class:"flex w-full flex-col space-y-4"},C={class:"flex-none"},M={class:"flex items-baseline justify-between"},T={class:"mb-4 text-2xl font-bold"},_={class:"text-muted-color text-sm"},D={class:"flex items-center justify-between"},N={class:""},Y={class:""},V={class:"text-muted-color text-sm"},A={key:0,class:"flex-none rounded border border-red-200 bg-red-50 p-4"},F={class:"text-red-800"},q={class:"mt-4 flex grow items-stretch overflow-clip rounded-lg"},E=["srcdoc"],U=y({__name:"MailShow",props:{mail:{type:Object,required:!0}},setup(n){return(o,a)=>(s(),r("div",z,[d(l(f),{class:"min-h-full",pt:{body:{class:"grow"},content:{class:"grow flex items-stretch"}}},{content:k(()=>[e("div",S,[e("div",C,[e("div",M,[e("h1",T,t(n.mail.subject),1),e("div",_,t(l(m)(n.mail.sent_at).format("MMMM D, YYYY h:mm A")),1)]),e("div",D,[e("div",N,[e("p",Y," To: "+t(n.mail.to_name?`${n.mail.to_name} <${n.mail.to_email}>`:n.mail.to_email),1),e("p",V," From: "+t(n.mail.from_name?`${n.mail.from_name} <${n.mail.from_email}>`:n.mail.from_email),1)]),d(l(g),{severity:n.mail.status==="success"?"success":"danger",value:n.mail.status,rounded:""},null,8,["severity","value"])])]),n.mail.error_message?(s(),r("div",A,[e("p",F,t(n.mail.error_message),1)])):i("",!0),e("div",q,[e("iframe",{class:"w-full",srcdoc:n.mail.content_html,frameborder:"0",allowfullscreen:""},null,8,E)])])]),_:1})]))}});export{U as default};
242 changes: 242 additions & 0 deletions dist/build/assets/app-aQLUJyJ9.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/build/assets/app-gflgPwOp.css

Large diffs are not rendered by default.

Loading