/ses-s3-reader

simple flask app for reading emails from an s3 bucket

Primary LanguagePython

ses-s3-inbox

Sometimes, you just wanna pump some emails from SES to S3. But what good is a pile of MIME files? This webapp helps make reading that pile a little easier.

Build Status

Purpose

So you've got a shiny new domain, and you want a lightweight mail box. So you think, "Ah! SES Receipt Rules!"
But what do you do with all these S3 objects with SMTP ids for object names? If you were like me, you probably downloaded each one, opened 'em in Sublime until you found that one message you were trying to find. Well no longer!

SES Setup

First, you'll need an S3 bucket for these emails to be written to. You'll also need to give SES permission to write to your bucket

Next, set up SES with a Receipt Rule that will trigger an S3 Action. I'd suggest using an object_prefix to keep your bucket organized.

Getting Started Receiving Email with Amazon SES

S3 Action Docs

Running

export FLASK_APP=app.py
flask run

or, if you're debugging or something, it can be invoked as a script at

python server.py

Docker

Checkout the repo, then

docker build -t ses-s3-reader .

To run:

docker run --rm -ti -p 5000:5000 -e BUCKET=MY_BUCKET -e OBJECT_PREFIX=email/ ses-s3-reader

Current Limitations:

  • The To, From, Date data on the Inbox page doesn't fill until you look at a message.
    • TODO: Have some sorta background job fetch message metadata in the background
  • No message meta-data is persisted after a restart
  • There should probably be a cacheing layer to save calls to S3
  • The MIME parsing is pretty bare-bones, wouldn't be suprised if it chokes

Screenshots

Message Screenshot