fix: resolver DNS nginx pour éviter cache IP stale après restart backend

This commit is contained in:
deploy
2026-04-30 21:14:27 +00:00
parent a1e7aa46d5
commit 018fb1d70f
57 changed files with 7 additions and 7579 deletions
-66
View File
@@ -1,66 +0,0 @@
import nodemailer from 'nodemailer';
import { decrypt } from '../crypto';
export interface UserSmtpConfig {
smtp_host: string;
smtp_port: number;
smtp_secure: boolean;
smtp_user: string;
smtp_pass_enc: string;
smtp_from_name: string;
smtp_from_email: string;
}
function createTransporter(user: UserSmtpConfig) {
return nodemailer.createTransport({
host: user.smtp_host,
port: user.smtp_port,
secure: user.smtp_secure,
auth: {
user: user.smtp_user,
pass: decrypt(user.smtp_pass_enc),
},
});
}
/**
* Envoie la facture par email.
* Expéditeur = compte SMTP de l'utilisateur connecté.
* Destinataire = email de la société à rembourser.
*/
export async function sendInvoiceEmail(
user: UserSmtpConfig,
toEmail: string,
pdfAbsPath: string,
pdfFilename: string
): Promise<void> {
const transporter = createTransporter(user);
await transporter.sendMail({
from: `"${user.smtp_from_name}" <${user.smtp_from_email}>`,
to: toEmail,
subject: 'Facture à rembourser',
text: '',
attachments: [
{
filename: pdfFilename,
path: pdfAbsPath,
contentType: 'application/pdf',
},
],
});
}
/**
* Email de test pour vérifier la config SMTP de l'utilisateur.
*/
export async function sendTestEmail(user: UserSmtpConfig): Promise<void> {
const transporter = createTransporter(user);
await transporter.sendMail({
from: `"${user.smtp_from_name}" <${user.smtp_from_email}>`,
to: user.smtp_from_email,
subject: '[NotesFrais] Test de configuration SMTP',
text: 'Votre configuration SMTP fonctionne correctement ✓',
});
}