AWS Lambda to process Email attachment data? - amazon-web-services

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?)

Related

How to send database report as csv sheet to an email?

I am needing to export some data from DynamoDB or Postgres as a csv and send that file to an email every month. Is there a scheduler I can set up that will do this for me? Or will I need to create a lambda function to export data and send the email every month?
To automate this as much as possible, your best bet is writing a lambda.
You can setup a recurring monthly event trigger using CloudWatch Events that will remove the need to manually kick things off.
Inside the lambda, your code would query the data from DynamoDB or Postgres, generate the CSV, and send it directly to the target over email as an attachment using Amazon SES (Simple Email Service). You could also choose to store the CSV in S3 before sending it over email, to have as a backup in case email delivery doesn't work as expected (for one reason or another).
Tutorial: Schedule AWS Lambda Functions Using CloudWatch Events
Using File Attachments with Amazon SES

Extract email attachment from SES into S3

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.

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?

How to receive meeting requests through amazon SES

I am looking for a way to receive all of my company emails and locate those that contain meeting requests, then extract and store following meeting information in a dynamoDB
Creator
Start
End
Location
Attendees
Is this possible and if so is amazon SES the correct route? Can currently receive emails through SES and store in a S3 bucket, but the email is in MIME formate and not all of the meeting information is readily available.
Trying to avoid having to build fancy string passing functions to extract this information if possible.

AWS SES - incoming email saving attachment to S3

I have the following use case:
Once and incoming email with attachment is received (SES)
Invoke a lambda function to Extract that email's attachment only and save to S3
I've looked at SES SDK (nodejs) and wasn't successful in finding an API that could help with this.
Is this supported out-of-the-box using SES SDK (nodejs, java)? Or one has to read the entire message and then figure out the attachment portion?
Has anyone with similar requirements been able to implement this?
This is not supported by the SES sdk. You will have to parse the raw MIME format and extract the file.
Take a look at this answer on how you can try that with Lambda