Extract email attachment from SES into S3 - amazon-web-services

I want to extract an email attachment and save that attachment into an S3 bucket. I have configured SES to intercept my incoming emails.
I am guessing I need to create a SES rule which would have an action to trigger a Lambda function that extracts the email attachment and stores it to S3. I am not sure how to write this Lambda function.

Related

AWS S3 sending content as attachment

Is there a direct way after saving something in a S3 bucket to send the content as attachment by SNS (via email) or do i have create a lambda function in order to tell SNS, what i want to send?
S3 bucket -> SNS -> Email (my preferred way, if possible)
or is this not possible without lambda?
The event that S3 sends to Lambda, SNS or SQS only contains a reference to the item that was created, not the actual content.
If you want to pass on the content, you have to download it in whichever code responds to that event and then send it to your destination.
There is no mechanism that sends the content of a newly uploaded object to an SNS topic.

AWS Lambda to process Email attachment data?

So my objective is to feed hundreds/thousands of emails into an Amazon S3 bucket and what I would like to do is to be able to extract certain metadata from these emails(which contain attachments). I would like to extract data such as the Sender's email, the Date of email arrival, the Email content and the attachment file name ad extension.
I should note that I am using Zapier to trigger whenever a new email with an attachment comes in, to send that emails attachment data into an Amazon S3 bucket. Though i'm wondering if there's a more efficient way of processing email data using AWS Lambda in this case?
(In a nutshell, what im asking is, using the following 3 tools: Zapier/AWS Lambda/S3, how can I best extract email attachment data? Could you please describe the flow?)

SNS with file attachment

I have SNS notification for a S3 bucket. I wanted to push that SNS notification with attachment
We have a S3 bucket namely like SDD-XXX-YYY. Once if any file is getting arrived in that bucket, we have configured SNS to receive email notification.
Now we need email notification with content of the file which we are receiving in S3 or as attachment in our email.
Example: We are receiving some "error.log" file S3, here we need to push the error.log in email or else content of error.log file.
Please help me to achieve it.
Do we need to write lambda here? or we can manage it in SNS itself?
The SNS S3 notification will only give you information about the newly created object.
You can see the structure of the event in Event Message Structure.
If you want to send the file via email you will have to write this logic in a Lambda function: you will use the information from the event (bucket and key) to download the object and then send it via email.
This function could subscribe to SNS or directly to S3.

Email user when file is uploaded to s3

Is there a way to automatically email a user when a certain file is uploaded to S3? We have a spreadsheet with contact information as well as a file name associated with that person. Once a person's file is uploaded, is there a way to send that user an automated email?
Yes. You can use AWS API Gateway to create an endpoint that accepts the file to upload and then, using AWS Lambda, upload it to S3 and trigger an event to send the email using mailchimp or AWS SES. Check this: https://codehabitude.com/2016/04/05/forms-to-emails-using-aws-lambda-api-gateway/
You could:
Configure an Amazon S3 event to trigger a Lambda function when a file is uploaded
Code the AWS Lambda function to lookup who should receive the notification and then send the message via Amazon SES (Simple Email Service)

Ordered attachments in SES inbound email (MIME format)

We're using Amazon SES to receive emails from a certain sub-domain. We configured it to pass the emails to an Amazon S3 Bucket.
We noticed that the email in S3 (MIME) does not show the list of attachments in the same order that they were attached when the email was being composed.
Is there a way to order the attachments in the email file in the same order that they were attached?