Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/dependabot/fetch-m…
Browse files Browse the repository at this point in the history
…etadata-2.2.0
  • Loading branch information
Baspa committed Sep 6, 2024
2 parents facedc6 + 0e7e0f8 commit dbeccf4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ public function panel(Panel $panel): Panel
}
```

### Features and screenshots
## Features and screenshots

#### List with all sent emails and statistics
### List with all sent emails and statistics

The package provides a clear overview of all emails, including statistics and the ability to filter the data.

![Filament Mails](https://github.com/vormkracht10/filament-mails/blob/main/docs/mails-list.png)

#### Resending emails
### Resending emails

You can resend emails to the same or another recipient(s). This is useful when your email has bounced and you want to resend it.

![Filament Mails](https://github.com/vormkracht10/filament-mails/blob/main/docs/mail-resend.png)

#### Information
### Information

You can view all relevant information about the email, such as the subject, the body, the attachments, the from address, the to address(es), the cc address(es), the bcc address(es), the reply to address, metadata and much more.

Expand All @@ -88,7 +88,7 @@ You can view all relevant information about the email, such as the subject, the

![Filament Mails](https://github.com/vormkracht10/filament-mails/blob/main/docs/mail-attachments.png)

#### Preview email
### Preview email

The package provides a preview of the email. This is useful to quickly check if the email is correct.

Expand All @@ -98,7 +98,7 @@ We also provide the raw HTML and plain text of the email.

![Filament Mails](https://github.com/vormkracht10/filament-mails/blob/main/docs/mail-raw-html.png)

#### Events
### Events

The package also logs all events that are fired when an email is sent. This is useful to track the email sending process.

Expand Down
3 changes: 2 additions & 1 deletion src/Controllers/MailDownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ class MailDownloadController extends Controller
{
public function __invoke(Request $request)
{
/** @var MailAttachment $attachment */
$attachment = MailAttachment::find($request->attachment);

$file = Storage::disk($attachment->disk)->get($attachment->uuid);

return response()->download($file);
}
}
}
3 changes: 2 additions & 1 deletion src/Controllers/MailPreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class MailPreviewController extends Controller
{
public function __invoke(Request $request)
{
/** @var Mail $mail */
$mail = Mail::find($request->mail);

return response($mail->html);
}
}
}
7 changes: 2 additions & 5 deletions src/Resources/EventResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public static function infolist(Infolist $infolist): Infolist
WebhookEventType::OPEN => 'success',
WebhookEventType::BOUNCE => 'danger',
WebhookEventType::COMPLAINT => 'danger',
default => 'gray',
})
->formatStateUsing(function (WebhookEventType $state) {
return ucfirst($state->value);
Expand Down Expand Up @@ -155,7 +154,6 @@ public static function infolist(Infolist $infolist): Infolist
->copyable()
->copyMessage(__('Copied'))
->copyMessageDuration(1500),

TextEntry::make('payload')
->label(__('Metadata'))
->formatStateUsing(function ($state) {
Expand Down Expand Up @@ -196,7 +194,6 @@ public static function table(Table $table): Table
WebhookEventType::OPEN => 'success',
WebhookEventType::BOUNCE => 'danger',
WebhookEventType::COMPLAINT => 'danger',
default => 'gray',
})
->formatStateUsing(function (WebhookEventType $state) {
return ucfirst($state->value);
Expand All @@ -205,12 +202,12 @@ public static function table(Table $table): Table
Tables\Columns\TextColumn::make('mail.subject')
->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.view', $record->mail))
->label(__('Subject'))
->searchable(),
->searchable(['subject', 'payload']),
Tables\Columns\TextColumn::make('occurred_at')
->label(__('Occurred At'))
->dateTime('d-m-Y H:i')
->since()
->tooltip(fn (MailEvent $record) => $record->occurred_at?->format('d-m-Y H:i'))
->tooltip(fn(MailEvent $record) => $record->occurred_at->format('d-m-Y H:i'))
->sortable()
->searchable(),
])
Expand Down
6 changes: 4 additions & 2 deletions src/Resources/MailResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public static function infolist(Infolist $infolist): Infolist
WebhookEventType::OPEN => 'success',
WebhookEventType::BOUNCE => 'danger',
WebhookEventType::COMPLAINT => 'danger',
default => 'gray',
})
->formatStateUsing(function (WebhookEventType $state) {
return ucfirst($state->value);
Expand Down Expand Up @@ -274,7 +273,7 @@ public static function table(Table $table): Table
->label(__('Subject'))
->limit(35)
->sortable()
->searchable(),
->searchable(['subject', 'html', 'text']),
Tables\Columns\IconColumn::make('attachments')
->label('')
->alignLeft()
Expand Down Expand Up @@ -341,6 +340,9 @@ public static function table(Table $table): Table
];
})
->action(function (Mail $record, array $data) {
$to = json_decode($data['to'], true) ?? [];
$cc = json_decode($data['cc'], true) ?? [];
$bcc = json_decode($data['bcc'], true) ?? [];

ResendMailJob::dispatch($record, $to, $cc, $bcc);

Expand Down

0 comments on commit dbeccf4

Please sign in to comment.