From 8362e28bf1ee339dc7e9057f55928d95f22334a3 Mon Sep 17 00:00:00 2001 From: bardolf69 <47841636+bardolf69@users.noreply.github.com> Date: Fri, 24 May 2024 08:51:09 +0700 Subject: [PATCH 01/11] Update InboundEmail.php Fix issues with forwarding emails after Laravel 9.0 --- src/InboundEmail.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/InboundEmail.php b/src/InboundEmail.php index 884445f..6e24fff 100644 --- a/src/InboundEmail.php +++ b/src/InboundEmail.php @@ -170,7 +170,8 @@ public function forward($recipients) return Mail::send([], [], function ($message) use ($recipients) { $message->to($recipients) ->subject($this->subject()) - ->setBody($this->body(), $this->message()->getContentType()); + ->text($this->text()) + ->html($this->html()); }); } From ba6f3baa1dd91287656457650982d066d9fb5829 Mon Sep 17 00:00:00 2001 From: Yi-pixel <31845646+Yi-pixel@users.noreply.github.com> Date: Fri, 14 Feb 2025 20:52:12 +0800 Subject: [PATCH 02/11] Fix implicitly nullable parameter declarations in PHP 8.4 See: https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated --- src/Routing/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Routing/Router.php b/src/Routing/Router.php index 390d839..216ac71 100644 --- a/src/Routing/Router.php +++ b/src/Routing/Router.php @@ -24,7 +24,7 @@ class Router /** @var Container */ protected $container; - public function __construct(Container $container = null) + public function __construct(?Container $container = null) { $this->container = $container ?: new Container; From 83129e3e77f8a34ee5c92695153ed0b6201a1c84 Mon Sep 17 00:00:00 2001 From: Shift Date: Sat, 15 Feb 2025 19:08:03 +0000 Subject: [PATCH 03/11] Bump dependencies for Laravel 12 --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 54c8a4d..44a1f50 100644 --- a/composer.json +++ b/composer.json @@ -17,19 +17,19 @@ ], "require": { "php": "^8.0", - "illuminate/container": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", - "illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", - "illuminate/log": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", - "illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/container": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/log": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", "willdurand/email-reply-parser": "^2.8", - "zbateson/mail-mime-parser": "^1.1|^2.4" + "zbateson/mail-mime-parser": "^1.1|^2.4|^3.0" }, "require-dev": { "laminas/laminas-mail": "^2.13", "mockery/mockery": "^1.2", - "orchestra/testbench": "^4.0|^5.0|^7.0|^8.0|^9.0", - "phpunit/phpunit": "^7.0|^8.0|^9.3|^10.5" + "orchestra/testbench": "^4.0|^5.0|^7.0|^8.0|^9.0|^10.0", + "phpunit/phpunit": "^7.0|^8.0|^9.3|^10.5|^11.5.3" }, "autoload": { "psr-4": { From 9aa4c74d44eb7df567c6c87a5093edcac76a8df4 Mon Sep 17 00:00:00 2001 From: Shift Date: Sat, 15 Feb 2025 19:08:03 +0000 Subject: [PATCH 04/11] Update GitHub Actions for Laravel 12 --- .github/workflows/run-tests.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4769dc8..9feeb6a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,7 +13,7 @@ jobs: matrix: os: [ubuntu-latest] php: [8.0, 8.1, 8.2] - laravel: ['8.*', '9.*', '10.*', '11.*'] + laravel: ['8.*', '9.*', '10.*', '11.*', '12.*'] stability: [prefer-stable] exclude: - php: 8.0 @@ -24,6 +24,10 @@ jobs: php: 8.0 - laravel: 11.* php: 8.1 + - laravel: 12.* + php: 8.0 + - laravel: 12.* + php: 8.1 include: - laravel: 10.* testbench: 8.* @@ -33,6 +37,8 @@ jobs: testbench: 6.23 - laravel: 11.* testbench: 9.* + - laravel: 12.* + testbench: 10.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} From 155fe1104d175a9deca7be78b002f928f47b3c19 Mon Sep 17 00:00:00 2001 From: Diana Scharf Date: Fri, 7 Mar 2025 09:24:38 +0100 Subject: [PATCH 05/11] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9feeb6a..1a4e492 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -56,7 +56,7 @@ jobs: - name: Install dependencies run: | composer install - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --dev --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: Execute tests From cfa756818bce9a982d9be793405821ae62cba51e Mon Sep 17 00:00:00 2001 From: Diana Scharf Date: Fri, 7 Mar 2025 09:28:19 +0100 Subject: [PATCH 06/11] wip --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1a4e492..2680a49 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -3,6 +3,7 @@ name: run-tests on: - push - pull_request + - workflow_dispatch jobs: test: From 68aeca4f644033391bf5450a30d3ba104b6b7110 Mon Sep 17 00:00:00 2001 From: Diana Scharf Date: Fri, 7 Mar 2025 09:34:56 +0100 Subject: [PATCH 07/11] Workflow trigger --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4769dc8..7bf6309 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -3,6 +3,7 @@ name: run-tests on: - push - pull_request + - workflow_dispatch jobs: test: From 0f88e88dda3dc7e7a24cb4598270be6871ad4359 Mon Sep 17 00:00:00 2001 From: Di Date: Fri, 7 Mar 2025 09:47:52 +0100 Subject: [PATCH 08/11] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index cf9098f..e50c4c4 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,16 @@ composer require beyondcode/laravel-mailbox Take a look at the [official documentation](https://docs.beyondco.de/laravel-mailbox). +## Catch, test and debug application mails with Laravel Herd + +Laravel Herd provides an integrated local email service, streamlining the process of testing and debugging application emails. +The email service organizes emails into distinct inboxes for each application, ensuring they are easily accessible and simple to locate. + +[herd.laravel.com](https://herd.laravel.com) + +![image](https://github.com/user-attachments/assets/6417907c-119d-43ac-9cf6-5638bafae24f) + + ### Testing ``` bash From e731b368082f4041a1810e98271a87ece0191e01 Mon Sep 17 00:00:00 2001 From: Anton Cherednichenko Date: Tue, 1 Apr 2025 15:57:52 +0200 Subject: [PATCH 09/11] Fix for a deprecated parameter: "Implicitly marking parameter $container as nullable is deprecated, the explicit nullable type must be used instead" --- src/Routing/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Routing/Router.php b/src/Routing/Router.php index 216ac71..4b32946 100644 --- a/src/Routing/Router.php +++ b/src/Routing/Router.php @@ -24,7 +24,7 @@ class Router /** @var Container */ protected $container; - public function __construct(?Container $container = null) + public function __construct(?Container $container) { $this->container = $container ?: new Container; From 7d5da44e272e16da84f2ece0a10d53c6d14e2b2e Mon Sep 17 00:00:00 2001 From: Cameron Wilby Date: Sat, 14 Jun 2025 14:21:09 -0700 Subject: [PATCH 10/11] Change CleanEmailsTest to create 200 emails --- tests/Console/CleanEmailsTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Console/CleanEmailsTest.php b/tests/Console/CleanEmailsTest.php index 78f88cd..5f18272 100644 --- a/tests/Console/CleanEmailsTest.php +++ b/tests/Console/CleanEmailsTest.php @@ -23,14 +23,14 @@ public function setUp(): void /** @test */ public function it_can_clean_the_statistics() { - Collection::times(60)->each(function (int $index) { + Collection::times(200)->each(function (int $index) { InboundEmail::forceCreate([ 'message' => Str::random(), 'created_at' => Carbon::now()->subDays($index)->startOfDay(), ]); }); - $this->assertCount(60, InboundEmail::all()); + $this->assertCount(200, InboundEmail::all()); Artisan::call('mailbox:clean'); @@ -46,19 +46,19 @@ public function it_errors_if_max_age_inf() { $this->app['config']->set('mailbox.store_incoming_emails_for_days', INF); - Collection::times(60)->each(function (int $index) { + Collection::times(200)->each(function (int $index) { InboundEmail::forceCreate([ 'message' => Str::random(), 'created_at' => Carbon::now()->subDays($index)->startOfDay(), ]); }); - $this->assertCount(60, InboundEmail::all()); + $this->assertCount(200, InboundEmail::all()); $this->artisan('mailbox:clean') ->expectsOutput('mailbox:clean is disabled because store_incoming_emails_for_days is set to INF.') ->assertExitCode(1); - $this->assertCount(60, InboundEmail::all()); + $this->assertCount(200, InboundEmail::all()); } } From e69ad082dad4fe291bf4c1fbc7152004cc16a44c Mon Sep 17 00:00:00 2001 From: Cameron Wilby Date: Sat, 14 Jun 2025 14:35:31 -0700 Subject: [PATCH 11/11] Use eachById when cleaning emails --- src/Console/CleanEmails.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Console/CleanEmails.php b/src/Console/CleanEmails.php index 8cd8e3c..d682313 100644 --- a/src/Console/CleanEmails.php +++ b/src/Console/CleanEmails.php @@ -37,12 +37,9 @@ public function handle() $modelClass::where('created_at', '<', $cutOffDate) ->select('id') - ->chunk(100, function ($models) use ($modelClass) { - foreach ($models as $model) { - $modelInstance = $modelClass::find($model->id); - $modelInstance->delete(); - $this->amountDeleted++; - } + ->eachById(count: 100, callback: function ($model) { + $model->delete(); + $this->amountDeleted++; }); $this->info("Deleted {$this->amountDeleted} record(s) from the Mailbox logs.");