From d9a43c7a1827230073cc7c3c876f366c8b7764ee Mon Sep 17 00:00:00 2001 From: Baspa Date: Tue, 24 Dec 2024 08:15:25 +0100 Subject: [PATCH 1/5] Add methods to docs --- src/Models/Mail.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Models/Mail.php b/src/Models/Mail.php index 1e8d74b..552846f 100644 --- a/src/Models/Mail.php +++ b/src/Models/Mail.php @@ -37,6 +37,13 @@ * * @method static Builder forUuid(string $uuid) * @method static Builder forMailClass(string $mailClass) + * @method static Builder|self sent() + * @method static Builder|self delivered() + * @method static Builder|self opened() + * @method static Builder|self clicked() + * @method static Builder|self softBounced() + * @method static Builder|self hardBounced() + * @method static Builder|self unsent() */ class Mail extends Model { From d18af5c155a89ae5698b8a289a4b17db0db5cf4a Mon Sep 17 00:00:00 2001 From: Baspa Date: Tue, 24 Dec 2024 08:21:25 +0100 Subject: [PATCH 2/5] Improve builder methods notation --- src/Models/Mail.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Models/Mail.php b/src/Models/Mail.php index 552846f..bdd3f88 100644 --- a/src/Models/Mail.php +++ b/src/Models/Mail.php @@ -37,13 +37,13 @@ * * @method static Builder forUuid(string $uuid) * @method static Builder forMailClass(string $mailClass) - * @method static Builder|self sent() - * @method static Builder|self delivered() - * @method static Builder|self opened() - * @method static Builder|self clicked() - * @method static Builder|self softBounced() - * @method static Builder|self hardBounced() - * @method static Builder|self unsent() + * @method static Builder sent() + * @method static Builder delivered() + * @method static Builder opened() + * @method static Builder clicked() + * @method static Builder softBounced() + * @method static Builder hardBounced() + * @method static Builder unsent() */ class Mail extends Model { From 6b398f8b7badb6abb84ef20da4ea204e91172c3f Mon Sep 17 00:00:00 2001 From: Baspa Date: Fri, 3 Jan 2025 11:20:20 +0100 Subject: [PATCH 3/5] Use attachmentModel to get storage path --- src/Actions/LogMail.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Actions/LogMail.php b/src/Actions/LogMail.php index 3dcf485..f4eaf31 100644 --- a/src/Actions/LogMail.php +++ b/src/Actions/LogMail.php @@ -101,7 +101,7 @@ protected function getCustomUuid(MessageSending|MessageSent $event): ?string protected function getAddressesValue(array $address): ?Collection { $addresses = collect($address) - ->flatMap(fn (Address $address) => [$address->getAddress() => $address->getName() === '' ? null : $address->getName()]); + ->flatMap(fn(Address $address) => [$address->getAddress() => $address->getName() === '' ? null : $address->getName()]); return $addresses->count() > 0 ? $addresses : null; } @@ -125,6 +125,6 @@ public function collectAttachments($mail, $attachments): void public function saveAttachment($attachmentModel, $attachment): void { Storage::disk($attachmentModel->disk) - ->put($attachment->storagePath, $attachment->getBody(), 'private'); + ->put($attachmentModel->storagePath, $attachment->getBody(), 'private'); } } From e5e18b7ad0b2fe08bf19fe607dd1772db03cbc1a Mon Sep 17 00:00:00 2001 From: Mark van Eijk Date: Fri, 3 Jan 2025 14:58:54 +0100 Subject: [PATCH 4/5] Update MailgunDriver.php --- src/Drivers/MailgunDriver.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Drivers/MailgunDriver.php b/src/Drivers/MailgunDriver.php index ea9a13d..5d7d393 100644 --- a/src/Drivers/MailgunDriver.php +++ b/src/Drivers/MailgunDriver.php @@ -15,6 +15,8 @@ public function registerWebhooks($components): void $apiKey = config('services.mailgun.secret'); $domain = config('services.mailgun.domain'); + $scheme = config('services.mailgun.scheme', 'https'); + $endpoint = config('services.mailgun.endpoint', 'api.mailgun.net'); $webhookUrl = URL::signedRoute('mails.webhook', ['provider' => 'mailgun']); @@ -49,7 +51,7 @@ public function registerWebhooks($components): void foreach ($events as $event) { $response = Http::withBasicAuth('api', $apiKey) ->asMultipart() - ->post("https://api.mailgun.net/v3/domains/$domain/webhooks", [ + ->post("$scheme://$endpoint/v3/domains/$domain/webhooks", [ 'id' => $event, 'url' => $webhookUrl, ]); From 454cd7f070ecbc259269245c4c1e566813cb520e Mon Sep 17 00:00:00 2001 From: Baspa Date: Fri, 3 Jan 2025 16:55:43 +0100 Subject: [PATCH 5/5] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36bc537..c591a9e 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ php artisan vendor:publish --tag="mails-migrations" php artisan migrate ``` -Add the API key of your email service provider to the `config/services.php` file in your Laravel project, currently we only support Postmark: +Add the API key of your email service provider to the `config/services.php` file in your Laravel project, currently we only support Postmark and Mailgun: ``` [