feat(mail): add Resend delivery, inbox replies and notification tiers

This commit is contained in:
hellcat committed 2026-10-10 18:53:35 +08:00
1 parent 208536e1cb
commit ad42a0e1e7
53 files changed
+2626 -43

No files matched your search

@@ -39,6 +39,7 @@ class ConfigController extends Controller
'email' => $request->user()->email,
'subject' => 'This is xboard test email',
'template_name' => 'notify',
'purpose' => 'admin_test',
'template_value' => [
'name' => admin_setting('app_name', 'XBoard'),
'content' => 'This is xboard test email',
@@ -154,6 +155,8 @@ class ConfigController extends Controller
'email_encryption' => admin_setting('email_encryption'),
'email_from_address' => admin_setting('email_from_address'),
'remind_mail_enable' => (bool) admin_setting('remind_mail_enable', false),
'automatic_mail_level' => \App\Services\MailFlow\AutomaticMailPolicy::state()['level'] ?? null,
'mail_flow' => \App\Services\MailFlow\Settings::publicSettings(),
],
'telegram' => [
'telegram_bot_enable' => (bool) admin_setting('telegram_bot_enable', 0),
@@ -222,6 +225,22 @@ class ConfigController extends Controller
];
foreach ($data as $k => $v) {
if ($k === 'automatic_mail_level') {
\App\Services\MailFlow\AutomaticMailPolicy::save((int) $v);
continue;
}
if ($k === 'mail_flow') {
$previous = (array) admin_setting('mail_flow', []);
foreach (['resend_key', 'resend_webhook_secret', 'imap_password'] as $secret) {
if (array_key_exists($secret, $v) && ($v[$secret] === null || $v[$secret] === '')) {
unset($v[$secret]); // Blank means keep the saved secret.
} elseif (!empty($v[$secret])) {
$v[$secret] = 'encrypted:' . \Illuminate\Support\Facades\Crypt::encryptString($v[$secret]);
}
}
$v = array_replace($previous, $v);
\Illuminate\Support\Facades\Cache::forget('mailflow:resend:usage');
}
if (isset($templateKeys[$k])) {
SubscribeTemplate::setContent($templateKeys[$k], $v);
continue;