mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
feat: add config for mail server name (#13632)
fix #13627 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added configurable display names for primary and fallback SMTP servers, improving email sender identification. * Defaults to “AFFiNE Server,” with support for MAILER_SERVERNAME environment variable for the primary SMTP. * Exposed in admin settings for easy setup alongside existing SMTP options. * Names are now passed through to mail transport options for consistent use across emails. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -6,6 +6,7 @@ declare global {
|
||||
interface AppConfigSchema {
|
||||
mailer: {
|
||||
SMTP: {
|
||||
name: string;
|
||||
host: string;
|
||||
port: number;
|
||||
username: string;
|
||||
@@ -16,6 +17,7 @@ declare global {
|
||||
|
||||
fallbackDomains: ConfigItem<string[]>;
|
||||
fallbackSMTP: {
|
||||
name: string;
|
||||
host: string;
|
||||
port: number;
|
||||
username: string;
|
||||
@@ -28,6 +30,11 @@ declare global {
|
||||
}
|
||||
|
||||
defineModuleConfig('mailer', {
|
||||
'SMTP.name': {
|
||||
desc: 'Name of the email server (e.g. your domain name)',
|
||||
default: 'AFFiNE Server',
|
||||
env: 'MAILER_SERVERNAME',
|
||||
},
|
||||
'SMTP.host': {
|
||||
desc: 'Host of the email server (e.g. smtp.gmail.com)',
|
||||
default: '',
|
||||
@@ -64,6 +71,10 @@ defineModuleConfig('mailer', {
|
||||
default: [],
|
||||
shape: z.array(z.string()),
|
||||
},
|
||||
'fallbackSMTP.name': {
|
||||
desc: 'Name of the fallback email server (e.g. your domain name)',
|
||||
default: 'AFFiNE Server',
|
||||
},
|
||||
'fallbackSMTP.host': {
|
||||
desc: 'Host of the email server (e.g. smtp.gmail.com)',
|
||||
default: '',
|
||||
|
||||
@@ -20,6 +20,7 @@ function configToSMTPOptions(
|
||||
config: AppConfig['mailer']['SMTP']
|
||||
): SMTPTransport.Options {
|
||||
return {
|
||||
name: config.name,
|
||||
host: config.host,
|
||||
port: config.port,
|
||||
tls: {
|
||||
|
||||
Reference in New Issue
Block a user