Files
k42api/test-welcome-email.js
2025-03-02 20:53:34 -04:00

37 lines
1010 B
JavaScript

// Direct test script for the email functionality
require('dotenv').config();
// Import the recently_added module
const emailModule = require('./cloud/emails/recently_added');
// Parse command line arguments
const args = process.argv.slice(2);
const testType = args[0] || 'recent'; // 'welcome', 'simple', or 'recent'
const recipient = args[1] || 'colemanjeff@mac.com';
console.log(`Email test type: ${testType}`);
// Execute the test function
async function runTest() {
try {
console.log(`Starting ${testType} email test to ${recipient}...`);
if (testType === 'welcome') {
await emailModule.testWelcomeEmail();
} else if (testType === 'recent') {
await emailModule.testRecentlyAddedEmail();
} else {
await emailModule.testSimpleEmail(recipient);
}
console.log('Test completed');
} catch (error) {
console.error('Test failed:', error);
} finally {
// Exit the process after completion
process.exit(0);
}
}
// Run the test
runTest();