From 7d608ed2cb61fed5e3aeb1d89bfea3ad6d5aa330 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 5 Aug 2022 10:03:09 +0800 Subject: [PATCH] Use parsed from, to and subject from email headers --- packages/inbound-email-handler/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/inbound-email-handler/src/index.ts b/packages/inbound-email-handler/src/index.ts index 5f2633f3c..4611d41c5 100644 --- a/packages/inbound-email-handler/src/index.ts +++ b/packages/inbound-email-handler/src/index.ts @@ -66,8 +66,8 @@ export const inboundEmailHandler = Sentry.GCPFunction.wrapHttpFunction( console.log('headers: ', headers) // original sender email address - const from = headers['from'].toString() - const subject = headers['subject']?.toString() + const from = parsed['from'] + const subject = parsed['subject'] const html = parsed['html'] const text = parsed['text'] @@ -80,7 +80,7 @@ export const inboundEmailHandler = Sentry.GCPFunction.wrapHttpFunction( const forwardedFrom = headers['x-forwarded-for']?.toString().split(' ')[0] // if an email is forwarded to the inbox, the to is the forwarding email recipient - const to = forwardedTo || headers['to'].toString() + const to = forwardedTo || parsed['to'] const postHeader = headers['list-post']?.toString() const unSubHeader = headers['list-unsubscribe']?.toString()