export interface MailAccount { id: string; email: string; name: string; owner: 'junwon' | 'ace'; imap: { host: string; port: number; user: string; password: string }; smtp: { host: string; port: number; user: string; password: string }; } const PASS_JUNWON = process.env.PURELYMAIL_PASS_JUNWON || ''; const PASS_ACE = process.env.PURELYMAIL_PASS || ''; const IMAP = { host: 'imap.purelymail.com', port: 993 }; const SMTP = { host: 'smtp.purelymail.com', port: 465 }; function account(owner: 'junwon' | 'ace', domain: string): MailAccount { const email = `${owner}@${domain}`; const pass = owner === 'junwon' ? PASS_JUNWON : PASS_ACE; return { id: `${owner}-${domain.split('.')[0]}`, email, name: owner === 'junwon' ? 'Junwon' : 'Ace', owner, imap: { ...IMAP, user: email, password: pass }, smtp: { ...SMTP, user: email, password: pass }, }; } export const ACCOUNTS: MailAccount[] = [ account('junwon', 'manglasabang.com'), account('junwon', 'palace.fund'), account('junwon', 'palacering.com'), account('ace', 'manglasabang.com'), account('ace', 'palace.fund'), account('ace', 'palacering.com'), ]; export function getAccount(id: string): MailAccount | undefined { return ACCOUNTS.find(a => a.id === id); }