diff --git a/CHANGES.md b/CHANGES.md index 4e1d90e180..9fac7874bb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ ## Fixes - Fix VCS/migration/assistant scopes [#6071](https://github.com/appwrite/appwrite/pull/6071) +- Add missing parameters required for custom email templates [#6077](https://github.com/appwrite/appwrite/pull/6077) ## Changes diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 784c0dce76..c6df38c3ca 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1048,17 +1048,19 @@ App::post('/v1/account/sessions/magic-url') $emailVariables = [ 'subject' => $subject, 'hello' => $locale->getText("emails.magicSession.hello"), - 'name' => '', 'body' => $body, - 'redirect' => $url, 'footer' => $locale->getText("emails.magicSession.footer"), 'thanks' => $locale->getText("emails.magicSession.thanks"), 'signature' => $locale->getText("emails.magicSession.signature"), - 'project' => $project->getAttribute('name'), 'direction' => $locale->getText('settings.direction'), 'bg-body' => '#f7f7f7', 'bg-content' => '#ffffff', 'text-content' => '#000000', + /* {{user}} ,{{team}}, {{project}} and {{redirect}} are required in the templates */ + 'user' => '', + 'team' => '', + 'project' => $project->getAttribute('name'), + 'redirect' => $url ]; $mails @@ -2501,17 +2503,19 @@ App::post('/v1/account/recovery') $emailVariables = [ 'subject' => $subject, 'hello' => $locale->getText("emails.recovery.hello"), - 'name' => $profile->getAttribute('name'), 'body' => $body, - 'redirect' => $url, 'footer' => $locale->getText("emails.recovery.footer"), 'thanks' => $locale->getText("emails.recovery.thanks"), 'signature' => $locale->getText("emails.recovery.signature"), - 'project' => $projectName, 'direction' => $locale->getText('settings.direction'), 'bg-body' => '#f7f7f7', 'bg-content' => '#ffffff', 'text-content' => '#000000', + /* {{user}} ,{{team}}, {{project}} and {{redirect}} are required in the templates */ + 'user' => $profile->getAttribute('name'), + 'team' => '', + 'project' => $projectName, + 'redirect' => $url ]; @@ -2751,17 +2755,19 @@ App::post('/v1/account/verification') $emailVariables = [ 'subject' => $subject, 'hello' => $locale->getText("emails.verification.hello"), - 'name' => $user->getAttribute('name'), 'body' => $body, - 'redirect' => $url, 'footer' => $locale->getText("emails.verification.footer"), 'thanks' => $locale->getText("emails.verification.thanks"), 'signature' => $locale->getText("emails.verification.signature"), - 'project' => $projectName, 'direction' => $locale->getText('settings.direction'), 'bg-body' => '#f7f7f7', 'bg-content' => '#ffffff', 'text-content' => '#000000', + /* {{user}} ,{{team}}, {{project}} and {{redirect}} are required in the templates */ + 'user' => $user->getAttribute('name'), + 'team' => '', + 'project' => $projectName, + 'redirect' => $url ]; $mails diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index e53ef2c34a..c5dd3eed12 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -599,20 +599,21 @@ App::post('/v1/teams/:teamId/memberships') $emailVariables = [ 'owner' => $user->getAttribute('name'), - 'team' => $team->getAttribute('name'), 'subject' => $subject, 'hello' => $locale->getText("emails.invitation.hello"), - 'name' => $user->getAttribute('name'), 'body' => $body, - 'redirect' => $url, 'footer' => $locale->getText("emails.invitation.footer"), 'thanks' => $locale->getText("emails.invitation.thanks"), 'signature' => $locale->getText("emails.invitation.signature"), - 'project' => $projectName, 'direction' => $locale->getText('settings.direction'), 'bg-body' => '#f7f7f7', 'bg-content' => '#ffffff', 'text-content' => '#000000', + /* {{user}} ,{{team}}, {{project}} and {{redirect}} are required in the templates */ + 'user' => $user->getAttribute('name'), + 'team' => $team->getAttribute('name'), + 'project' => $projectName, + 'redirect' => $url ]; $mails diff --git a/app/workers/mails.php b/app/workers/mails.php index 9ef26af0f1..27d8f85f04 100644 --- a/app/workers/mails.php +++ b/app/workers/mails.php @@ -35,9 +35,9 @@ class MailsV1 extends Worker $recipient = $this->args['recipient']; $subject = $this->args['subject']; - $name = $this->args['name']; $body = $this->args['body']; $variables = $this->args['variables']; + $name = $variables['user'] ?? ''; $body = Template::fromFile(__DIR__ . '/../config/locale/templates/email-base.tpl');