mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 05:30:41 +01:00
The playbook expected no SES call sites, but lib/email/service.ts is live
(consultations route sends welcome + admin mails through it), so a bare dep
removal would have broken the build. Instead the transport is swapped to the
fleet's mail layer:
- EmailService now sends via @bitbaum/mail-kit sendMail; the throw-on-failure
contract is preserved for the catching caller
- Sender comes from RESEND_FROM (fleet SSOT) with conventionalFrom('Botsmann')
fallback; FROM_EMAIL and NEXT_AWS_* reads deleted from email config paths
- @aws-sdk/client-ses removed; tests mock @bitbaum/mail-kit instead of SES,
with a new failed-send assertion
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
/**
|
|
* Email Configuration
|
|
*
|
|
* Centralized configuration for all email-related settings.
|
|
* Uses environment variables with sensible defaults for development/build.
|
|
* Validation happens at runtime when email service is used.
|
|
*/
|
|
|
|
/**
|
|
* Get environment variable with fallback default
|
|
* Defaults are used for development and build, but should be overridden
|
|
* in production via environment variables.
|
|
*/
|
|
const getEnvWithDefault = (key: string, fallback: string): string => {
|
|
return process.env[key] || fallback;
|
|
};
|
|
|
|
/**
|
|
* Email Addresses
|
|
*
|
|
* The SENDER is not configured here: @bitbaum/mail-kit reads RESEND_FROM
|
|
* (fleet env SSOT) with the conventional fleet sender as fallback.
|
|
*/
|
|
export const EMAIL_ADDRESSES = {
|
|
/** Email address for admin notifications */
|
|
admin: getEnvWithDefault('ADMIN_EMAIL', 'admin@botsmann.com'),
|
|
|
|
/** Email address for customer support */
|
|
support: getEnvWithDefault('SUPPORT_EMAIL', 'support@botsmann.com'),
|
|
} as const;
|
|
|
|
/**
|
|
* Email Subjects
|
|
*/
|
|
export const EMAIL_SUBJECTS = {
|
|
welcome: 'Welcome to Botsmann!',
|
|
newCustomer: 'New Customer Registration',
|
|
waitlistConfirmation: "You're on the Waitlist!",
|
|
consultationConfirmation: 'Consultation Booking Confirmed',
|
|
} as const;
|
|
|
|
/**
|
|
* Email URLs
|
|
*/
|
|
export const EMAIL_URLS = {
|
|
dashboard: process.env.NEXT_PUBLIC_APP_URL
|
|
? `${process.env.NEXT_PUBLIC_APP_URL}/dashboard`
|
|
: 'https://botsmann.com/dashboard',
|
|
unsubscribe: process.env.NEXT_PUBLIC_APP_URL
|
|
? `${process.env.NEXT_PUBLIC_APP_URL}/unsubscribe`
|
|
: 'https://botsmann.com/unsubscribe',
|
|
} as const;
|
|
|
|
export type EmailConfig = {
|
|
addresses: typeof EMAIL_ADDRESSES;
|
|
subjects: typeof EMAIL_SUBJECTS;
|
|
urls: typeof EMAIL_URLS;
|
|
};
|
|
|
|
export const emailConfig: EmailConfig = {
|
|
addresses: EMAIL_ADDRESSES,
|
|
subjects: EMAIL_SUBJECTS,
|
|
urls: EMAIL_URLS,
|
|
};
|