Add multi-account OAuth, Obsidian integration, product assets, and test tooling
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
46
src/smtp.ts
46
src/smtp.ts
@@ -26,6 +26,16 @@ function getSmtpTransport(account: Account = 'yahoo') {
|
||||
return fetcherpaySmtpTransport(process.env['LEADS_EMAIL']!, process.env['LEADS_PASSWORD']!);
|
||||
case 'founder':
|
||||
return fetcherpaySmtpTransport(process.env['FOUNDER_EMAIL']!, process.env['FOUNDER_PASSWORD']!);
|
||||
case 'gmail':
|
||||
return nodemailer.createTransport({
|
||||
host: 'smtp.gmail.com',
|
||||
port: 587,
|
||||
secure: false,
|
||||
auth: {
|
||||
user: process.env['GMAIL_EMAIL']!,
|
||||
pass: process.env['GMAIL_APP_PASSWORD']!,
|
||||
},
|
||||
});
|
||||
default:
|
||||
return nodemailer.createTransport({
|
||||
host: 'smtp.mail.yahoo.com',
|
||||
@@ -47,6 +57,7 @@ function getSenderEmail(account: Account = 'yahoo'): string {
|
||||
sales: process.env['SALES_EMAIL'] ?? '',
|
||||
leads: process.env['LEADS_EMAIL'] ?? '',
|
||||
founder: process.env['FOUNDER_EMAIL'] ?? '',
|
||||
gmail: process.env['GMAIL_EMAIL'] ?? '',
|
||||
};
|
||||
return emailMap[account] ?? '';
|
||||
}
|
||||
@@ -88,17 +99,30 @@ export async function createDraft(
|
||||
leads: { user: process.env['LEADS_EMAIL']!, pass: process.env['LEADS_PASSWORD']! },
|
||||
founder: { user: process.env['FOUNDER_EMAIL']!, pass: process.env['FOUNDER_PASSWORD']! },
|
||||
};
|
||||
const imapConfig = fetcherpayImapAccounts[account]
|
||||
? { ...fetcherpayImapBase, auth: fetcherpayImapAccounts[account]! }
|
||||
: {
|
||||
host: 'imap.mail.yahoo.com',
|
||||
port: 993,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: process.env['YAHOO_EMAIL']!,
|
||||
pass: process.env['YAHOO_APP_PASSWORD']!,
|
||||
},
|
||||
};
|
||||
let imapConfig;
|
||||
if (fetcherpayImapAccounts[account]) {
|
||||
imapConfig = { ...fetcherpayImapBase, auth: fetcherpayImapAccounts[account]! };
|
||||
} else if (account === 'gmail') {
|
||||
imapConfig = {
|
||||
host: 'imap.gmail.com',
|
||||
port: 993,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: process.env['GMAIL_EMAIL']!,
|
||||
pass: process.env['GMAIL_APP_PASSWORD']!,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
imapConfig = {
|
||||
host: 'imap.mail.yahoo.com',
|
||||
port: 993,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: process.env['YAHOO_EMAIL']!,
|
||||
pass: process.env['YAHOO_APP_PASSWORD']!,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const client = new ImapFlow(imapConfig);
|
||||
await client.connect();
|
||||
|
||||
Reference in New Issue
Block a user