AI Newsletter Digest improvements: fixed QP soft line break decoding, URL extraction, and content cleaning

This commit is contained in:
Krilly
2026-03-04 13:29:22 +00:00
parent 29a98137a7
commit 57dd294675
13706 changed files with 2114953 additions and 237629 deletions

View File

@@ -0,0 +1,45 @@
/**
* Email utility using AWS SES SMTP
*/
import nodemailer from 'nodemailer';
// Create reusable transporter
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: parseInt(process.env.SMTP_PORT || '587'),
secure: false, // Use STARTTLS
auth: {
user: process.env.SMTP_USERNAME,
pass: process.env.SMTP_PASSWORD
}
});
interface EmailOptions {
to: string;
subject: string;
html: string;
from?: string;
}
/**
* Send an email via AWS SES
*/
export async function sendEmail(options: EmailOptions) {
const from = options.from || process.env.FROM_EMAIL || 'noreply@viralguru.app';
try {
const info = await transporter.sendMail({
from,
to: options.to,
subject: options.subject,
html: options.html
});
console.log('Email sent:', info.messageId);
return { success: true, messageId: info.messageId };
} catch (error) {
console.error('Email send failed:', error);
throw error;
}
}