Checkpoint: Amélioration du système d'envoi d'emails : intégration de Resend pour l'envoi réel d'emails avec fallback vers simulation si non configuré. Documentation complète ajoutée dans EMAIL_SETUP.md pour guider la configuration.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { generateFormationICS } from "./icsGenerator";
|
||||
import { notifyOwner } from "./_core/notification";
|
||||
import { sendEmail as sendEmailViaService, isEmailServiceConfigured } from "./_core/emailSender";
|
||||
|
||||
interface EmailParams {
|
||||
to: string;
|
||||
@@ -18,36 +18,11 @@ interface EmailParams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie un email en utilisant le système de notification Manus
|
||||
* Note: Pour un envoi SMTP réel, intégrer un service comme SendGrid ou Mailgun
|
||||
* Envoie un email via le service d'envoi configuré
|
||||
* Utilise Resend si RESEND_API_KEY est configuré, sinon simule l'envoi
|
||||
*/
|
||||
async function sendEmail(params: EmailParams): Promise<boolean> {
|
||||
console.log('=== EMAIL ENVOYÉ ===');
|
||||
console.log('To:', params.to);
|
||||
console.log('Subject:', params.subject);
|
||||
|
||||
// Envoyer une notification au propriétaire du projet
|
||||
const emailContent = `
|
||||
Destinataire: ${params.to}
|
||||
Sujet: ${params.subject}
|
||||
|
||||
${params.html.replace(/<[^>]*>/g, '').substring(0, 500)}...
|
||||
|
||||
${params.attachments ? `Pièces jointes: ${params.attachments.map(a => a.filename).join(', ')}` : ''}`;
|
||||
|
||||
try {
|
||||
await notifyOwner({
|
||||
title: `Email envoyé: ${params.subject}`,
|
||||
content: emailContent,
|
||||
});
|
||||
console.log('✓ Email traité avec succès');
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de l\'envoi de la notification:', error);
|
||||
}
|
||||
|
||||
console.log('===================');
|
||||
|
||||
return true;
|
||||
return await sendEmailViaService(params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user