commit 6633506429fb44f26a20ce3ee63d6af897af04ae
parent 5d88c90f02cc803be26bdd3ab5906cbfc247f3ef
Author: AMIT DUTTA <amitdutta4255@gmail.com>
Date: Sun, 22 Feb 2026 15:06:11 +0530
Fix email fetching method and replyTo property
Updated email fetching method and corrected property name for replyTo.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/server.js b/server.js
@@ -51,7 +51,9 @@ app.post('/api/incoming', express.text({ type: 'application/json' }), async (req
if (!htmlBody && !textBody && emailData.email_id) {
try {
console.log(`Body missing in webhook. Fetching email ${emailData.email_id} via API...`);
- const fetchedResponse = await resend.emails.get(emailData.email_id);
+
+ // FIX: Use 'receiving.get' instead of 'get' for fetching inbound emails
+ const fetchedResponse = await resend.emails.receiving.get(emailData.email_id);
if (fetchedResponse && fetchedResponse.data) {
htmlBody = fetchedResponse.data.html;
@@ -69,7 +71,7 @@ app.post('/api/incoming', express.text({ type: 'application/json' }), async (req
const payload = {
from: `Forwarder <${forwardingAddress}>`,
to: [personalGmail],
- replyTo: originalSender,
+ reply_to: originalSender, // FIX: Strictly match Resend API property name
subject: subject
};