dealing with duplicate emails

1

I have setup SES to receive email and put them in an S3 bucket. I then have a Lambda function that processes the emails.

The problem I am seeing is that if a single email is sent to 2 or more addresses that the SES rule set is monitoring (for example, an email is addressed to user1@mydomain and user2@mydomain) then 2 identical emails get put into the S3 bucket. They have different S3 keys, but they contain the exact same email. So, when my Lambda function processes the emails, that email is processed multiple times.

Is there a way to differentiate the emails so that I process the email once for each recipient in the To: list?

Thanks for your insight.

1개 답변
1

I figured this out. Turns out every email has a 'Received' element that you can look at. For instance:
In python, I did the following:
mailFor = message.get('Received', [])
Then, the mailfor dict has a number of things related to the message and that includes a single email address indicating who it is for.

I was able to strip out the address from that dict and determine who it was for and then process it without having duplicates.

tyarmas
답변함 4년 전

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

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

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

관련 콘텐츠