Compare commits

..

4 Commits

Author SHA1 Message Date
Esteban Paz c75399a431 Merge pull request 'staging' (#80) from staging into production
Deploy cdrdpyj / deploy (push) Successful in 1m44s Details
Reviewed-on: #80
2026-08-03 05:07:51 +00:00
Esteban Paz 3fd64368a2 Merge pull request 'add failover to n8n if not have credits to send emails from cloudflare' (#79) from main into staging
Deploy cdrdpyj / deploy (push) Successful in 1m3s Details
Reviewed-on: #79
2026-08-03 05:06:05 +00:00
Esteban Paz 8224dd5517 add failover to n8n if not have credits to send emails from cloudflare 2026-08-03 00:05:21 -05:00
Esteban Paz 144ce428f0 Merge pull request 'multiple fixes for pt and add editorial' (#77) from main into staging
Deploy cdrdpyj / deploy (push) Successful in 58s Details
Reviewed-on: #77
2026-08-02 23:22:41 +00:00
1 changed files with 21 additions and 16 deletions

View File

@ -80,6 +80,7 @@ export async function sendEmailCf(data: Record<string, string>, to: string, type
const apiToken = import.meta.env.CLOUDFLARE_API_TOKEN;
const accountId = import.meta.env.CLOUDFLARE_ACCOUNT_ID;
try {
const client = new Cloudflare({ apiToken });
const { subject } = TEMPLATE_URLS[type];
const rawHtml = await fetchTemplate(type);
@ -99,6 +100,10 @@ export async function sendEmailCf(data: Record<string, string>, to: string, type
console.error("Cloudflare email not delivered", response);
throw new Error("El correo no fue entregado");
}
} catch (error) {
console.error("Cloudflare email failed, fallback a n8n:", error);
await sendEmail(data, to, type);
}
}
// ═══════════════════════════════════════════════════════════════