notamitgamer

It's my profile man, there is ...
Log | Files | Refs | README

commit 43d7bff0947d1ce14b43a93e7aea5189edef442a
parent 350a07b937babd547b2cef5de67ac18b608159e1
Author: AMIT DUTTA <amitdutta4255@gmail.com>
Date:   Sun, 22 Feb 2026 14:47:55 +0530

Refactor email payload handling for clarity
Diffstat:
Mserver.js | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/server.js b/server.js @@ -53,16 +53,19 @@ app.post('/api/incoming', express.text({ type: 'application/json' }), async (req subject: subject }; - if (emailData.html) { + const hasHtml = emailData.html && emailData.html.trim().length > 0; + const hasText = emailData.text && emailData.text.trim().length > 0; + + if (hasHtml) { payload.html = emailData.html; } - if (emailData.text) { + if (hasText) { payload.text = emailData.text; } - if (!emailData.html && !emailData.text) { - payload.text = 'No content found in the original email.'; + if (!hasHtml && !hasText) { + payload.text = "DIAGNOSTIC MODE: No body found. Here is exactly what Resend saw:\n\n" + JSON.stringify(emailData, null, 2); } const { data, error } = await resend.emails.send(payload);
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror