diff --git a/app/Notifications/Channels/TransactionalEmailChannel.php b/app/Notifications/Channels/TransactionalEmailChannel.php index 1fb3f1971..730aec8f4 100644 --- a/app/Notifications/Channels/TransactionalEmailChannel.php +++ b/app/Notifications/Channels/TransactionalEmailChannel.php @@ -36,16 +36,6 @@ class TransactionalEmailChannel private function bootConfigs(InstanceSettings $settings): void { - config()->set('mail.default', 'smtp'); - config()->set('mail.mailers.smtp', [ - "transport" => "smtp", - "host" => $settings->extra_attributes?->get('smtp_host'), - "port" => $settings->extra_attributes?->get('smtp_port'), - "encryption" => $settings->extra_attributes?->get('smtp_encryption'), - "username" => $settings->extra_attributes?->get('smtp_username'), - "password" => $settings->extra_attributes?->get('smtp_password'), - "timeout" => $settings->extra_attributes?->get('smtp_timeout'), - "local_domain" => null, - ]); + set_transanctional_email_settings(); } } diff --git a/app/Notifications/TransactionalEmails/ResetPasswordEmail.php b/app/Notifications/TransactionalEmails/ResetPasswordEmail.php index a23b64d47..6a02a3f43 100644 --- a/app/Notifications/TransactionalEmails/ResetPasswordEmail.php +++ b/app/Notifications/TransactionalEmails/ResetPasswordEmail.php @@ -24,7 +24,11 @@ class ResetPasswordEmail extends Notification implements ShouldQueue public function toMail(User $user): MailMessage { - $url = url('/') . '/reset-password/' . $this->token . '?email=' . $user->email; + if (config('app.env') === 'local') { + $url = url('/') . ":8000" . '/reset-password/' . $this->token . '?email=' . $user->email; + } else { + $url = url('/') . '/reset-password/' . $this->token . '?email=' . $user->email; + } $mail = new MailMessage(); $mail->subject('Reset Password'); $mail->view('emails.reset-password', [ diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index d5259ae94..9671f89c3 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -65,3 +65,19 @@ function is_transactional_emails_active() { return data_get(InstanceSettings::get(), 'extra_attributes.smtp_host'); } + +function set_transanctional_email_settings() +{ + $settings = InstanceSettings::get(); + config()->set('mail.default', 'smtp'); + config()->set('mail.mailers.smtp', [ + "transport" => "smtp", + "host" => $settings->extra_attributes?->get('smtp_host'), + "port" => $settings->extra_attributes?->get('smtp_port'), + "encryption" => $settings->extra_attributes?->get('smtp_encryption'), + "username" => $settings->extra_attributes?->get('smtp_username'), + "password" => $settings->extra_attributes?->get('smtp_password'), + "timeout" => $settings->extra_attributes?->get('smtp_timeout'), + "local_domain" => null, + ]); +} diff --git a/resources/views/auth/forgot-password.blade.php b/resources/views/auth/forgot-password.blade.php index 5be08eeec..afacfaf80 100644 --- a/resources/views/auth/forgot-password.blade.php +++ b/resources/views/auth/forgot-password.blade.php @@ -9,7 +9,7 @@