diff --git a/app/config/console.php b/app/config/console.php index f8f68a8039..d872c68ac8 100644 --- a/app/config/console.php +++ b/app/config/console.php @@ -9,6 +9,8 @@ use Appwrite\Network\Platform; use Utopia\Database\Helpers\ID; use Utopia\System\System; +$localeCodes = include __DIR__ . '/locale/codes.php'; + $console = [ '$id' => ID::custom('console'), '$sequence' => ID::custom('console'), @@ -50,6 +52,18 @@ $console = [ 'githubAppid' => System::getEnv('_APP_CONSOLE_GITHUB_APP_ID', '') ], 'smtpBaseTemplate' => APP_BRANDED_EMAIL_BASE_TEMPLATE, + 'customEmailContent' => [ + 'verification' => [ + 'en' => [ + 'preview' => 'Verify your email to activate your {{project}} account.', + 'heading' => 'Verify your email to start using {{project}}', + ] + ] + ] ]; +foreach ($localeCodes as $localeCode) { + $console['customEmailContent']['verification'][$localeCode['code']] = $console['customEmailContent']['verification']['en']; +} + return $console; diff --git a/app/config/locale/translations/en.json b/app/config/locale/translations/en.json index 473ced86c0..705ffac8bf 100644 --- a/app/config/locale/translations/en.json +++ b/app/config/locale/translations/en.json @@ -4,8 +4,6 @@ "settings.direction": "ltr", "emails.sender": "{{project}} Team", "emails.verification.subject": "Account Verification for {{project}}", - "emails.verification.preview-appwrite": "Verify your email to activate your {{project}} account.", - "emails.verification.heading-appwrite": "Verify your email to start using {{project}}", "emails.verification.preview": "Verify your email for {{project}} account.", "emails.verification.heading": "Verify your email for {{project}}", "emails.verification.hello": "Hello {{user}},", diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index b98fe6c1c8..28479bc797 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -3636,8 +3636,14 @@ App::post('/v1/account/verifications/email') $projectName = $project->isEmpty() ? 'Console' : $project->getAttribute('name', '[APP-NAME]'); $body = $locale->getText("emails.verification.body"); $subject = $locale->getText("emails.verification.subject"); - $preview = $projectName === 'Appwrite' ? $locale->getText("emails.verification.preview-appwrite") : $locale->getText("emails.verification.preview"); - $heading = $projectName === 'Appwrite' ? $locale->getText("emails.verification.heading-appwrite") : $locale->getText("emails.verification.heading"); + $preview = $locale->getText("emails.verification.preview"); + $heading = $locale->getText("emails.verification.heading"); + + $customEmailContent = $project->getAttribute('customEmailContent', [])['verification'][$locale->default] ?? []; + if (!empty($customEmailContent)) { + $preview = $customEmailContent['preview'] ?? $preview; + $heading = $customEmailContent['heading'] ?? $heading; + } $customTemplate = $project->getAttribute('templates', [])['email.verification-' . $locale->default] ?? []; $smtpBaseTemplate = $project->getAttribute('smtpBaseTemplate', 'email-base');