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
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠