From d14f43fbbe0e28a3a5b7f1d3c7c31cc6259540d6 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 18 Nov 2024 10:54:03 -0800 Subject: [PATCH 1/5] replace env with config variable for from address --- app/Mail/CheckinAccessoryMail.php | 2 +- app/Mail/CheckinAssetMail.php | 2 +- app/Mail/CheckinLicenseMail.php | 2 +- app/Mail/CheckoutAccessoryMail.php | 2 +- app/Mail/CheckoutAssetMail.php | 2 +- app/Mail/CheckoutConsumableMail.php | 2 +- app/Mail/CheckoutLicenseMail.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Mail/CheckinAccessoryMail.php b/app/Mail/CheckinAccessoryMail.php index fc8d1455f9..707be0c2b4 100644 --- a/app/Mail/CheckinAccessoryMail.php +++ b/app/Mail/CheckinAccessoryMail.php @@ -34,7 +34,7 @@ class CheckinAccessoryMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + $from = new Address(config('mail.from.address','service@snipe-it.io')); return new Envelope( from: $from, diff --git a/app/Mail/CheckinAssetMail.php b/app/Mail/CheckinAssetMail.php index 5dd8394a5a..3b457c7f03 100644 --- a/app/Mail/CheckinAssetMail.php +++ b/app/Mail/CheckinAssetMail.php @@ -43,7 +43,7 @@ class CheckinAssetMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + $from = new Address(config('mail.from.address','service@snipe-it.io')); return new Envelope( from: $from, diff --git a/app/Mail/CheckinLicenseMail.php b/app/Mail/CheckinLicenseMail.php index 8957f367ef..73e09eabf4 100644 --- a/app/Mail/CheckinLicenseMail.php +++ b/app/Mail/CheckinLicenseMail.php @@ -34,7 +34,7 @@ class CheckinLicenseMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + $from = new Address(config('mail.from.address','service@snipe-it.io')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutAccessoryMail.php b/app/Mail/CheckoutAccessoryMail.php index f297c02754..6c6baeb633 100644 --- a/app/Mail/CheckoutAccessoryMail.php +++ b/app/Mail/CheckoutAccessoryMail.php @@ -37,7 +37,7 @@ class CheckoutAccessoryMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + $from = new Address(config('mail.from.address','service@snipe-it.io')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutAssetMail.php b/app/Mail/CheckoutAssetMail.php index fa1290e92d..84c2fb2165 100644 --- a/app/Mail/CheckoutAssetMail.php +++ b/app/Mail/CheckoutAssetMail.php @@ -52,7 +52,7 @@ class CheckoutAssetMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(env('MAIL_FROM_ADDR', 'service@snipe-it.io')); + $from = new Address(config('mail.from.address', 'service@snipe-it.io')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutConsumableMail.php b/app/Mail/CheckoutConsumableMail.php index 18fe228258..aa9a4dc803 100644 --- a/app/Mail/CheckoutConsumableMail.php +++ b/app/Mail/CheckoutConsumableMail.php @@ -38,7 +38,7 @@ class CheckoutConsumableMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + $from = new Address(config('mail.from.address','service@snipe-it.io')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutLicenseMail.php b/app/Mail/CheckoutLicenseMail.php index 7377ad340e..a7dffe4ea4 100644 --- a/app/Mail/CheckoutLicenseMail.php +++ b/app/Mail/CheckoutLicenseMail.php @@ -36,7 +36,7 @@ class CheckoutLicenseMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + $from = new Address(config('mail.from.address','service@snipe-it.io')); return new Envelope( from: $from, From f533cdc07aea557e53adcf36e2ab1df689fd18ba Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 18 Nov 2024 12:39:28 -0800 Subject: [PATCH 2/5] update default from address to alternate config variable --- app/Mail/CheckinAccessoryMail.php | 2 +- app/Mail/CheckinAssetMail.php | 2 +- app/Mail/CheckinLicenseMail.php | 2 +- app/Mail/CheckoutAccessoryMail.php | 2 +- app/Mail/CheckoutAssetMail.php | 2 +- app/Mail/CheckoutConsumableMail.php | 2 +- app/Mail/CheckoutLicenseMail.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Mail/CheckinAccessoryMail.php b/app/Mail/CheckinAccessoryMail.php index 707be0c2b4..d573a4436f 100644 --- a/app/Mail/CheckinAccessoryMail.php +++ b/app/Mail/CheckinAccessoryMail.php @@ -34,7 +34,7 @@ class CheckinAccessoryMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address','service@snipe-it.io')); + $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); return new Envelope( from: $from, diff --git a/app/Mail/CheckinAssetMail.php b/app/Mail/CheckinAssetMail.php index 3b457c7f03..cf660b21ea 100644 --- a/app/Mail/CheckinAssetMail.php +++ b/app/Mail/CheckinAssetMail.php @@ -43,7 +43,7 @@ class CheckinAssetMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address','service@snipe-it.io')); + $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); return new Envelope( from: $from, diff --git a/app/Mail/CheckinLicenseMail.php b/app/Mail/CheckinLicenseMail.php index 73e09eabf4..709879ec1b 100644 --- a/app/Mail/CheckinLicenseMail.php +++ b/app/Mail/CheckinLicenseMail.php @@ -34,7 +34,7 @@ class CheckinLicenseMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address','service@snipe-it.io')); + $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutAccessoryMail.php b/app/Mail/CheckoutAccessoryMail.php index 6c6baeb633..1c3f53402d 100644 --- a/app/Mail/CheckoutAccessoryMail.php +++ b/app/Mail/CheckoutAccessoryMail.php @@ -37,7 +37,7 @@ class CheckoutAccessoryMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address','service@snipe-it.io')); + $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutAssetMail.php b/app/Mail/CheckoutAssetMail.php index 84c2fb2165..3a1480e8bd 100644 --- a/app/Mail/CheckoutAssetMail.php +++ b/app/Mail/CheckoutAssetMail.php @@ -52,7 +52,7 @@ class CheckoutAssetMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address', 'service@snipe-it.io')); + $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutConsumableMail.php b/app/Mail/CheckoutConsumableMail.php index aa9a4dc803..833b562699 100644 --- a/app/Mail/CheckoutConsumableMail.php +++ b/app/Mail/CheckoutConsumableMail.php @@ -38,7 +38,7 @@ class CheckoutConsumableMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address','service@snipe-it.io')); + $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutLicenseMail.php b/app/Mail/CheckoutLicenseMail.php index a7dffe4ea4..691169d8ac 100644 --- a/app/Mail/CheckoutLicenseMail.php +++ b/app/Mail/CheckoutLicenseMail.php @@ -36,7 +36,7 @@ class CheckoutLicenseMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address','service@snipe-it.io')); + $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); return new Envelope( from: $from, From b513575643341152938cb93800846c3be497016d Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 19 Nov 2024 09:10:52 -0800 Subject: [PATCH 3/5] add testing example var MAIL_FROM_ADDR --- .env.testing.example | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.env.testing.example b/.env.testing.example index 26211f95c3..6090cd910f 100644 --- a/.env.testing.example +++ b/.env.testing.example @@ -17,3 +17,5 @@ DB_PORT=3306 DB_DATABASE=null DB_USERNAME=null DB_PASSWORD=null + +MAIL_FROM_ADDR=you@example.com From 99de639be42f910c83b4b279bfbe1af8c42f6ba1 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 19 Nov 2024 09:32:11 -0800 Subject: [PATCH 4/5] fix mail.from.address variables in config, simplify envelop[ variable --- app/Mail/CheckinAccessoryMail.php | 2 +- app/Mail/CheckinAssetMail.php | 2 +- app/Mail/CheckinLicenseMail.php | 2 +- app/Mail/CheckoutAccessoryMail.php | 2 +- app/Mail/CheckoutAssetMail.php | 2 +- app/Mail/CheckoutConsumableMail.php | 2 +- app/Mail/CheckoutLicenseMail.php | 2 +- config/mail.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Mail/CheckinAccessoryMail.php b/app/Mail/CheckinAccessoryMail.php index d573a4436f..cddd1bfab9 100644 --- a/app/Mail/CheckinAccessoryMail.php +++ b/app/Mail/CheckinAccessoryMail.php @@ -34,7 +34,7 @@ class CheckinAccessoryMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); + $from = new Address(config('mail.from.address')); return new Envelope( from: $from, diff --git a/app/Mail/CheckinAssetMail.php b/app/Mail/CheckinAssetMail.php index cf660b21ea..d348100eba 100644 --- a/app/Mail/CheckinAssetMail.php +++ b/app/Mail/CheckinAssetMail.php @@ -43,7 +43,7 @@ class CheckinAssetMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); + $from = new Address(config('mail.from.address')); return new Envelope( from: $from, diff --git a/app/Mail/CheckinLicenseMail.php b/app/Mail/CheckinLicenseMail.php index 709879ec1b..8ebc946c00 100644 --- a/app/Mail/CheckinLicenseMail.php +++ b/app/Mail/CheckinLicenseMail.php @@ -34,7 +34,7 @@ class CheckinLicenseMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); + $from = new Address(config('mail.from.address')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutAccessoryMail.php b/app/Mail/CheckoutAccessoryMail.php index 1c3f53402d..9d7d3dba05 100644 --- a/app/Mail/CheckoutAccessoryMail.php +++ b/app/Mail/CheckoutAccessoryMail.php @@ -37,7 +37,7 @@ class CheckoutAccessoryMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); + $from = new Address(config('mail.from.address')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutAssetMail.php b/app/Mail/CheckoutAssetMail.php index 3a1480e8bd..d5c5e23fae 100644 --- a/app/Mail/CheckoutAssetMail.php +++ b/app/Mail/CheckoutAssetMail.php @@ -52,7 +52,7 @@ class CheckoutAssetMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); + $from = new Address(config('mail.from.address')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutConsumableMail.php b/app/Mail/CheckoutConsumableMail.php index 833b562699..ec68125ef3 100644 --- a/app/Mail/CheckoutConsumableMail.php +++ b/app/Mail/CheckoutConsumableMail.php @@ -38,7 +38,7 @@ class CheckoutConsumableMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); + $from = new Address(config('mail.from.address')); return new Envelope( from: $from, diff --git a/app/Mail/CheckoutLicenseMail.php b/app/Mail/CheckoutLicenseMail.php index 691169d8ac..80b226d9bf 100644 --- a/app/Mail/CheckoutLicenseMail.php +++ b/app/Mail/CheckoutLicenseMail.php @@ -36,7 +36,7 @@ class CheckoutLicenseMail extends Mailable */ public function envelope(): Envelope { - $from = new Address(config('mail.from.address'),config('MAIL_ENV_FROM_ADDR')); + $from = new Address(config('mail.from.address')); return new Envelope( from: $from, diff --git a/config/mail.php b/config/mail.php index 4f39fac842..16025bde20 100755 --- a/config/mail.php +++ b/config/mail.php @@ -237,7 +237,7 @@ return [ */ 'from' => [ - 'address' => env('MAIL_FROM_ADDR', null), + 'address' => env('MAIL_FROM_ADDR', env('MAIL_ENV_FROM_ADDR')), 'name' => env('MAIL_FROM_NAME', null), ], From 6969b8be47ea8163c9abe4fc35398c5f3d5dd0a2 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 20 Nov 2024 14:25:57 -0800 Subject: [PATCH 5/5] remove the changes to mail.from.address default --- config/mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/mail.php b/config/mail.php index 16025bde20..4f39fac842 100755 --- a/config/mail.php +++ b/config/mail.php @@ -237,7 +237,7 @@ return [ */ 'from' => [ - 'address' => env('MAIL_FROM_ADDR', env('MAIL_ENV_FROM_ADDR')), + 'address' => env('MAIL_FROM_ADDR', null), 'name' => env('MAIL_FROM_NAME', null), ],