Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.
fix: display actual error message when email test fails
Miguel Ribeiroebc7b83e9a0a
diff --git a/endpoints/cronjobs/sendnotifications.php b/endpoints/cronjobs/sendnotifications.phpindex 693497f..f76449d 100644--- a/endpoints/cronjobs/sendnotifications.php+++ b/endpoints/cronjobs/sendnotifications.php@@ -626,6 +626,7 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {foreach ($perUser as $k => $subscription) {// Ensure the payload is reset for each subscription$payload = $webhook['payload'];+ $payload = str_replace("{{days_until}}", $days, $payload);$payload = str_replace("{{subscription_name}}", $subscription['name'], $payload);$payload = str_replace("{{subscription_price}}", $subscription['price'], $payload);$payload = str_replace("{{subscription_currency}}", $subscription['currency'], $payload);diff --git a/endpoints/notifications/testemailnotifications.php b/endpoints/notifications/testemailnotifications.phpindex 266411a..94c13f1 100644--- a/endpoints/notifications/testemailnotifications.php+++ b/endpoints/notifications/testemailnotifications.php@@ -66,19 +66,26 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {$mail->Subject = translate('wallos_notification', $i18n);$mail->Body = translate('test_notification', $i18n);- if ($mail->send()) {- $response = [- "success" => true,- "message" => translate('notification_sent_successfuly', $i18n)- ];- die(json_encode($response));- } else {+ try {+ if ($mail->send()) {+ $response = [+ "success" => true,+ "message" => translate('notification_sent_successfuly', $i18n)+ ];+ } else {+ $response = [+ "success" => false,+ "message" => translate('email_error', $i18n) . $mail->ErrorInfo+ ];+ }+ } catch (Exception $e) {$response = ["success" => false,- "message" => translate('email_error', $i18n) . $mail->ErrorInfo+ "message" => translate('email_error', $i18n) . $e->getMessage()];- die(json_encode($response));}++ die(json_encode($response));}}diff --git a/includes/version.php b/includes/version.phpindex e6ab29f..b4985c0 100644--- a/includes/version.php+++ b/includes/version.php@@ -1,3 +1,3 @@<?php-$version = "v2.31.0";+$version = "v2.31.1";?>\ No newline at end of file