Files
rxminder/services/email.ts
2025-09-23 12:19:15 -07:00

30 lines
1.0 KiB
TypeScript

/**
* Mock email service for sending verification emails
*/
import { logger } from './logging';
export class EmailService {
/**
* Simulates sending a verification email with a link to /verify-email?token=${token}
* @param email - The recipient's email address
* @param token - The verification token
*/
async sendVerificationEmail(email: string, token: string): Promise<void> {
// In a real implementation, this would send an actual email
// For this demo, we'll just log the action
logger.info(
`Sending verification email to ${email} with token: ${token}`,
'EMAIL'
);
logger.info(`Verification link: /verify-email?token=${token}`, 'EMAIL');
// Simulate network delay
await new Promise(resolve => setTimeout(resolve, 500));
// In a real implementation, we would make an HTTP request to an email service
// Example: await fetch('/api/send-email', { method: 'POST', body: JSON.stringify({ email, token }) });
}
}
export const emailService = new EmailService();