From 506e8c658df3451ca33d0eb901d7bd5b8a2a5672 Mon Sep 17 00:00:00 2001
From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com>
Date: Mon, 22 Jan 2024 13:48:19 +0530
Subject: [PATCH] Refactored url construction
---
app/config/locale/templates/email-webhook-failed.tpl | 2 +-
src/Appwrite/Platform/Workers/Mails.php | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/app/config/locale/templates/email-webhook-failed.tpl b/app/config/locale/templates/email-webhook-failed.tpl
index e374d16711..b76f323572 100644
--- a/app/config/locale/templates/email-webhook-failed.tpl
+++ b/app/config/locale/templates/email-webhook-failed.tpl
@@ -14,7 +14,7 @@
\ No newline at end of file
diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php
index b4b792f0f1..2dfe1e7031 100644
--- a/src/Appwrite/Platform/Workers/Mails.php
+++ b/src/Appwrite/Platform/Workers/Mails.php
@@ -57,11 +57,13 @@ class Mails extends Action
$log->addTag('type', empty($smtp) ? 'cloud' : 'smtp');
+ $protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
+ $hostname = App::getEnv('_APP_DOMAIN');
+
$recipient = $payload['recipient'];
$subject = $payload['subject'];
$variables = $payload['variables'];
- $variables['protocol'] = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
- $variables['hostname'] = App::getEnv('_APP_DOMAIN');
+ $variables['host'] = $protocol . '://' . $hostname;
$name = $payload['name'];
$body = $payload['body'];