feat: send welcome emails through smtp
This commit is contained in:
@@ -19,8 +19,11 @@ const environmentSchema = z.object({
|
||||
INVITATION_TTL_HOURS: z.coerce.number().int().min(1).max(24 * 90).default(24 * 7),
|
||||
PASSWORD_RESET_TTL_HOURS: z.coerce.number().int().min(1).max(24 * 30).default(24),
|
||||
AUDIT_LOG_PAGE_SIZE: z.coerce.number().int().min(10).max(500).default(50),
|
||||
RESEND_API_KEY: optionalEnvironmentValue(z.string().min(20)),
|
||||
EMAIL_FROM: optionalEnvironmentValue(z.string().trim().min(3).max(320)),
|
||||
SMTP_HOST: optionalEnvironmentValue(z.string().trim().min(1).max(255)),
|
||||
SMTP_PORT: optionalEnvironmentValue(z.coerce.number().int().min(1).max(65_535)),
|
||||
SMTP_USER: optionalEnvironmentValue(z.string().trim().min(1).max(320)),
|
||||
SMTP_PASS: optionalEnvironmentValue(z.string().min(1).max(1_000)),
|
||||
MAIL_FROM: optionalEnvironmentValue(z.string().trim().min(3).max(320)),
|
||||
BUNNY_STREAM_LIBRARY_ID: optionalEnvironmentValue(z.coerce.number().int().positive()),
|
||||
BUNNY_STREAM_API_KEY: optionalEnvironmentValue(z.string().min(20)),
|
||||
BUNNY_EMBED_TOKEN_KEY: optionalEnvironmentValue(z.string().min(20)),
|
||||
@@ -61,6 +64,7 @@ if (bunnyStorageConfigurationValues.some(Boolean) && !bunnyStorageConfigurationV
|
||||
throw new Error('BUNNY_STORAGE_ZONE, BUNNY_STORAGE_PASSWORD, BUNNY_STORAGE_ENDPOINT, and BUNNY_STORAGE_CDN_HOST must be configured together.');
|
||||
}
|
||||
|
||||
if (Boolean(config.RESEND_API_KEY) !== Boolean(config.EMAIL_FROM)) {
|
||||
throw new Error('RESEND_API_KEY and EMAIL_FROM must be configured together.');
|
||||
const smtpConfigurationValues = [config.SMTP_HOST, config.SMTP_PORT, config.SMTP_USER, config.SMTP_PASS, config.MAIL_FROM];
|
||||
if (smtpConfigurationValues.some(Boolean) && !smtpConfigurationValues.every(Boolean)) {
|
||||
throw new Error('SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, and MAIL_FROM must be configured together.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user