How to access an email body when invoking a Lambda Function upon receiving an email through SES?

0

I have a rule to invoke a Lambda Function when SES receives an email. This works fine. I pass Lambda the event as an argument in the handler and assign an email constant a value of "event.Records[0].ses.mail". When console logging this value, I cannot find the content body showing the actual body of the email. Instead, I can only view the subject, recipient, sender, etc. How do I access the body of an email sent to my domain?

This is my current handler:

const handler = async (event) => {
        // Get Email
        const email = event.Records[0].ses.mail // console logs fine, but has no content/email body

       // Get Body
       const body = ?
}

1回答
1
承認された回答

Instead of triggering on the event of receiving an email in SES, why not trigger when the received email is saved in S3?
Set up an event trigger in the S3 bucket for receiving emails and run Lambda.
When the event is triggered, you can check the body of the email by using Lambda to get_object the object.
https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/with-s3-example.html#with-s3-example-create-trigger

profile picture
エキスパート
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ