Osama Khalid
Osama Khalid

Reputation: 337

Download email attachment and upload S3 bucket AWS

I have a web app hosted on aws under free tier limit. What I want to achieve is that whenever I received an email, i want the system to download its attachment(will be images only), upload that image to s3 and save the image id in database with email's sender email address. I don't want to use zapier api etc, I want to code it my self. How can I achieve this?

Upvotes: 2

Views: 8304

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269826

This really depends upon how your email is hosted.

You could use Receive Email with Amazon Simple Email Service.

The flow could then either be:

  • SES -> S3 -> Trigger Event -> AWS Lambda function, or
  • SES -> SNS -> AWS Lambda function

You would then need to write a Lambda function to do the processing you described.

If, on the other hand, your email is being hosted elsewhere, then you will need a mechanism to trigger some code when an email is received (somehow on your email system) or a scheduled Lambda function to poll the email system to see whether new mail is available.

Upvotes: 3

Related Questions