mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
More backwards compatibility
This commit is contained in:
@@ -2305,8 +2305,10 @@ Http::post('/v1/account/tokens/magic-url')
|
||||
if (!empty($smtp['senderName'])) {
|
||||
$senderName = $smtp['senderName'];
|
||||
}
|
||||
if (!empty($smtp['replyToEmail'])) {
|
||||
$replyToEmail = $smtp['replyToEmail'];
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$smtpReplyToEmail = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '';
|
||||
if (!empty($smtpReplyToEmail)) {
|
||||
$replyToEmail = $smtpReplyToEmail;
|
||||
}
|
||||
if (!empty($smtp['replyToName'])) {
|
||||
$replyToName = $smtp['replyToName'];
|
||||
@@ -2326,8 +2328,10 @@ Http::post('/v1/account/tokens/magic-url')
|
||||
if (!empty($customTemplate['senderName'])) {
|
||||
$senderName = $customTemplate['senderName'];
|
||||
}
|
||||
if (!empty($customTemplate['replyToEmail'])) {
|
||||
$replyToEmail = $customTemplate['replyToEmail'];
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$customReplyToEmail = $customTemplate['replyToEmail'] ?? $customTemplate['replyTo'] ?? '';
|
||||
if (!empty($customReplyToEmail)) {
|
||||
$replyToEmail = $customReplyToEmail;
|
||||
}
|
||||
if (!empty($customTemplate['replyToName'])) {
|
||||
$replyToName = $customTemplate['replyToName'];
|
||||
@@ -2618,8 +2622,8 @@ Http::post('/v1/account/tokens/email')
|
||||
|
||||
$senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
|
||||
$senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
|
||||
$replyToEmail = '';
|
||||
$replyToName = '';
|
||||
$replyToEmail = '';
|
||||
$replyToName = '';
|
||||
|
||||
if ($smtpEnabled) {
|
||||
if (!empty($smtp['senderEmail'])) {
|
||||
@@ -2628,9 +2632,11 @@ Http::post('/v1/account/tokens/email')
|
||||
if (!empty($smtp['senderName'])) {
|
||||
$senderName = $smtp['senderName'];
|
||||
}
|
||||
if (!empty($smtp['replyToEmail'])) {
|
||||
$replyToEmail = $smtp['replyToEmail'];
|
||||
}
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$smtpReplyToEmail = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '';
|
||||
if (!empty($smtpReplyToEmail)) {
|
||||
$replyToEmail = $smtpReplyToEmail;
|
||||
}
|
||||
if (!empty($smtp['replyToName'])) {
|
||||
$replyToName = $smtp['replyToName'];
|
||||
}
|
||||
@@ -2649,9 +2655,11 @@ Http::post('/v1/account/tokens/email')
|
||||
if (!empty($customTemplate['senderName'])) {
|
||||
$senderName = $customTemplate['senderName'];
|
||||
}
|
||||
if (!empty($customTemplate['replyToEmail'])) {
|
||||
$replyToEmail = $customTemplate['replyToEmail'];
|
||||
}
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$customReplyToEmail = $customTemplate['replyToEmail'] ?? $customTemplate['replyTo'] ?? '';
|
||||
if (!empty($customReplyToEmail)) {
|
||||
$replyToEmail = $customReplyToEmail;
|
||||
}
|
||||
if (!empty($customTemplate['replyToName'])) {
|
||||
$replyToName = $customTemplate['replyToName'];
|
||||
}
|
||||
@@ -2661,7 +2669,7 @@ Http::post('/v1/account/tokens/email')
|
||||
}
|
||||
|
||||
$queueForMails
|
||||
->setSmtpReplyToEmail($replyToEmail)
|
||||
->setSmtpReplyToEmail($replyToEmail)
|
||||
->setSmtpReplyToName($replyToName)
|
||||
->setSmtpSenderEmail($senderEmail)
|
||||
->setSmtpSenderName($senderName);
|
||||
@@ -3758,8 +3766,8 @@ Http::post('/v1/account/recovery')
|
||||
|
||||
$senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
|
||||
$senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
|
||||
$replyToEmail = '';
|
||||
$replyToName = '';
|
||||
$replyToEmail = '';
|
||||
$replyToName = '';
|
||||
|
||||
if ($smtpEnabled) {
|
||||
if (!empty($smtp['senderEmail'])) {
|
||||
@@ -3768,9 +3776,11 @@ Http::post('/v1/account/recovery')
|
||||
if (!empty($smtp['senderName'])) {
|
||||
$senderName = $smtp['senderName'];
|
||||
}
|
||||
if (!empty($smtp['replyToEmail'])) {
|
||||
$replyToEmail = $smtp['replyToEmail'];
|
||||
}
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$smtpReplyToEmail = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '';
|
||||
if (!empty($smtpReplyToEmail)) {
|
||||
$replyToEmail = $smtpReplyToEmail;
|
||||
}
|
||||
if (!empty($smtp['replyToName'])) {
|
||||
$replyToName = $smtp['replyToName'];
|
||||
}
|
||||
@@ -3789,9 +3799,11 @@ Http::post('/v1/account/recovery')
|
||||
if (!empty($customTemplate['senderName'])) {
|
||||
$senderName = $customTemplate['senderName'];
|
||||
}
|
||||
if (!empty($customTemplate['replyToEmail'])) {
|
||||
$replyToEmail = $customTemplate['replyToEmail'];
|
||||
}
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$customReplyToEmail = $customTemplate['replyToEmail'] ?? $customTemplate['replyTo'] ?? '';
|
||||
if (!empty($customReplyToEmail)) {
|
||||
$replyToEmail = $customReplyToEmail;
|
||||
}
|
||||
if (!empty($customTemplate['replyToName'])) {
|
||||
$replyToName = $customTemplate['replyToName'];
|
||||
}
|
||||
@@ -3801,7 +3813,7 @@ Http::post('/v1/account/recovery')
|
||||
}
|
||||
|
||||
$queueForMails
|
||||
->setSmtpReplyToEmail($replyToEmail)
|
||||
->setSmtpReplyToEmail($replyToEmail)
|
||||
->setSmtpReplyToName($replyToName)
|
||||
->setSmtpSenderEmail($senderEmail)
|
||||
->setSmtpSenderName($senderName);
|
||||
@@ -4083,8 +4095,8 @@ Http::post('/v1/account/verifications/email')
|
||||
|
||||
$senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
|
||||
$senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
|
||||
$replyToEmail = '';
|
||||
$replyToName = '';
|
||||
$replyToEmail = '';
|
||||
$replyToName = '';
|
||||
|
||||
if ($smtpEnabled) {
|
||||
if (!empty($smtp['senderEmail'])) {
|
||||
@@ -4093,9 +4105,11 @@ Http::post('/v1/account/verifications/email')
|
||||
if (!empty($smtp['senderName'])) {
|
||||
$senderName = $smtp['senderName'];
|
||||
}
|
||||
if (!empty($smtp['replyToEmail'])) {
|
||||
$replyToEmail = $smtp['replyToEmail'];
|
||||
}
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$smtpReplyToEmail = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '';
|
||||
if (!empty($smtpReplyToEmail)) {
|
||||
$replyToEmail = $smtpReplyToEmail;
|
||||
}
|
||||
if (!empty($smtp['replyToName'])) {
|
||||
$replyToName = $smtp['replyToName'];
|
||||
}
|
||||
@@ -4114,9 +4128,11 @@ Http::post('/v1/account/verifications/email')
|
||||
if (!empty($customTemplate['senderName'])) {
|
||||
$senderName = $customTemplate['senderName'];
|
||||
}
|
||||
if (!empty($customTemplate['replyToEmail'])) {
|
||||
$replyToEmail = $customTemplate['replyToEmail'];
|
||||
}
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$customReplyToEmail = $customTemplate['replyToEmail'] ?? $customTemplate['replyTo'] ?? '';
|
||||
if (!empty($customReplyToEmail)) {
|
||||
$replyToEmail = $customReplyToEmail;
|
||||
}
|
||||
if (!empty($customTemplate['replyToName'])) {
|
||||
$replyToName = $customTemplate['replyToName'];
|
||||
}
|
||||
@@ -4126,7 +4142,7 @@ Http::post('/v1/account/verifications/email')
|
||||
}
|
||||
|
||||
$queueForMails
|
||||
->setSmtpReplyToEmail($replyToEmail)
|
||||
->setSmtpReplyToEmail($replyToEmail)
|
||||
->setSmtpReplyToName($replyToName)
|
||||
->setSmtpSenderEmail($senderEmail)
|
||||
->setSmtpSenderName($senderName);
|
||||
|
||||
@@ -716,6 +716,12 @@ Http::get('/v1/projects/:projectId/templates/email/:type/:locale')
|
||||
$templates = $project->getAttribute('templates', []);
|
||||
$template = $templates['email.' . $type . '-' . $locale] ?? null;
|
||||
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
if (!is_null($template)) {
|
||||
$template['replyToEmail'] = $template['replyToEmail'] ?? $template['replyTo'] ?? '';
|
||||
$template['replyToName'] = $template['replyToName'] ?? '';
|
||||
}
|
||||
|
||||
$localeObj = new Locale($locale);
|
||||
$localeObj->setFallback(System::getEnv('_APP_LOCALE', 'en'));
|
||||
|
||||
@@ -1031,7 +1037,7 @@ Http::delete('/v1/projects/:projectId/templates/email/:type/:locale')
|
||||
'senderName' => $template['senderName'],
|
||||
'senderEmail' => $template['senderEmail'],
|
||||
'subject' => $template['subject'],
|
||||
'replyToEmail' => $template['replyToEmail'] ?? '',
|
||||
'replyToEmail' => $template['replyToEmail'] ?? $template['replyTo'] ?? '', // Includes backwards compatibility
|
||||
'replyToName' => $template['replyToName'] ?? '',
|
||||
'message' => $template['message']
|
||||
]), Response::MODEL_EMAIL_TEMPLATE);
|
||||
|
||||
@@ -131,7 +131,7 @@ class Mails extends Listener
|
||||
->setSmtpUsername($smtp['username'] ?? '')
|
||||
->setSmtpPassword($smtp['password'] ?? '')
|
||||
->setSmtpSecure($smtp['secure'] ?? '')
|
||||
->setSmtpReplyToEmail($customTemplate['replyToEmail'] ?? $smtp['replyToEmail'] ?? '')
|
||||
->setSmtpReplyToEmail($customTemplate['replyToEmail'] ?? $customTemplate['replyTo'] ?? $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '') // Includes backwards compatibility
|
||||
->setSmtpReplyToName($customTemplate['replyToName'] ?? $smtp['replyToName'] ?? '')
|
||||
->setSmtpSenderEmail($customTemplate['senderEmail'] ?? $smtp['senderEmail'] ?? System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM))
|
||||
->setSmtpSenderName($customTemplate['senderName'] ?? $smtp['senderName'] ?? System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'));
|
||||
|
||||
@@ -263,8 +263,10 @@ class Create extends Action
|
||||
if (!empty($smtp['senderName'])) {
|
||||
$senderName = $smtp['senderName'];
|
||||
}
|
||||
if (!empty($smtp['replyToEmail'])) {
|
||||
$replyToEmail = $smtp['replyToEmail'];
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$smtpReplyToEmail = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '';
|
||||
if (!empty($smtpReplyToEmail)) {
|
||||
$replyToEmail = $smtpReplyToEmail;
|
||||
}
|
||||
if (!empty($smtp['replyToName'])) {
|
||||
$replyToName = $smtp['replyToName'];
|
||||
@@ -284,8 +286,10 @@ class Create extends Action
|
||||
if (!empty($customTemplate['senderName'])) {
|
||||
$senderName = $customTemplate['senderName'];
|
||||
}
|
||||
if (!empty($customTemplate['replyToEmail'])) {
|
||||
$replyToEmail = $customTemplate['replyToEmail'];
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$customReplyToEmail = $customTemplate['replyToEmail'] ?? $customTemplate['replyTo'] ?? '';
|
||||
if (!empty($customReplyToEmail)) {
|
||||
$replyToEmail = $customReplyToEmail;
|
||||
}
|
||||
if (!empty($customTemplate['replyToName'])) {
|
||||
$replyToName = $customTemplate['replyToName'];
|
||||
|
||||
@@ -104,7 +104,7 @@ class Create extends Action
|
||||
|
||||
$senderName = $paramSenderName ?: ($smtp['senderName'] ?? '');
|
||||
$senderEmail = $paramSenderEmail ?: ($smtp['senderEmail'] ?? '');
|
||||
$replyToEmail = $paramReplyTo ?: ($smtp['replyToEmail'] ?? '');
|
||||
$replyToEmail = $paramReplyTo ?: ($smtp['replyToEmail'] ?? $smtp['replyTo'] ?? ''); // Includes backwards compatibility
|
||||
$replyToName = $smtp['replyToName'] ?? '';
|
||||
$host = $paramHost ?: ($smtp['host'] ?? '');
|
||||
$port = $paramPort ?? ($smtp['port'] ?? '');
|
||||
|
||||
@@ -351,8 +351,10 @@ class Create extends Action
|
||||
if (! empty($smtp['senderName'])) {
|
||||
$senderName = $smtp['senderName'];
|
||||
}
|
||||
if (! empty($smtp['replyToEmail'])) {
|
||||
$replyToEmail = $smtp['replyToEmail'];
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$smtpReplyToEmail = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '';
|
||||
if (! empty($smtpReplyToEmail)) {
|
||||
$replyToEmail = $smtpReplyToEmail;
|
||||
}
|
||||
if (! empty($smtp['replyToName'])) {
|
||||
$replyToName = $smtp['replyToName'];
|
||||
@@ -372,8 +374,10 @@ class Create extends Action
|
||||
if (! empty($customTemplate['senderName'])) {
|
||||
$senderName = $customTemplate['senderName'];
|
||||
}
|
||||
if (! empty($customTemplate['replyToEmail'])) {
|
||||
$replyToEmail = $customTemplate['replyToEmail'];
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$customReplyToEmail = $customTemplate['replyToEmail'] ?? $customTemplate['replyTo'] ?? '';
|
||||
if (! empty($customReplyToEmail)) {
|
||||
$replyToEmail = $customReplyToEmail;
|
||||
}
|
||||
if (! empty($customTemplate['replyToName'])) {
|
||||
$replyToName = $customTemplate['replyToName'];
|
||||
|
||||
@@ -173,7 +173,9 @@ class Mails extends Action
|
||||
$replyTo = $customMailOptions['replyToEmail'] ?? $replyTo;
|
||||
$replyToName = $customMailOptions['replyToName'] ?? $replyToName;
|
||||
} elseif (!empty($smtp)) {
|
||||
$replyTo = !empty($smtp['replyToEmail']) ? $smtp['replyToEmail'] : ($smtp['senderEmail'] ?? $replyTo);
|
||||
// Includes backwards compatibility: fall back to legacy `replyTo` key
|
||||
$smtpReplyToEmail = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? '';
|
||||
$replyTo = !empty($smtpReplyToEmail) ? $smtpReplyToEmail : ($smtp['senderEmail'] ?? $replyTo);
|
||||
$replyToName = !empty($smtp['replyToName']) ? $smtp['replyToName'] : ($smtp['senderName'] ?? $replyToName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user