Giter Site home page Giter Site logo

sendy's Introduction

Save Mail - Email Uploaded to Amazon S3

This app uploads emails it receives to S3. Out of the box, it works well to create "View On Web" links within personalized emails.

Requirements

Quick Start

To start using this app you must do two things: deploy the app and setup your parse webhook.

  1. Clone the repository to your computer.
    git clone https://github.com/nquinlan/save-mail.git save-mail
  2. Move into the repository.
    cd save-mail
  3. Initialize Heroku.
    heroku init
  4. Provide Heroku with your app's credentials.
    heroku config:set S3_ACCESS_KEY_ID=your-s3-access-key S3_SECRET_ACCESS_KEY=your-s3-secret-key S3_BUCKET=your-s3-bucket
  5. Deploy to Heroku.
    git push heroku master
  6. Setup a webhook to post to your new Heroku app.

This will start saving all mail received by the domain the Parse Webhook is setup on.

URLs

By default Save Mail saves each email with a Universally Unique Identifier, however, you may specify what you wish the file name to be instead.

You may specify the URL (or at least the file name) you intend for the stored email to have by specifying an X-Save-Mail-ID in the headers of your message (as seen below). This ID will be the file name for the email when uploaded to S3.

X-Save-Mail-ID: super-cool-message

The message will be stored on S3 at http://s3.amazonaws.com/your-bucket-name/super-cool-message.html

All files stored by Save Mail have the extension .html

Templates

Save Mail comes with two templates, found in _templates, however you may modify and change these how you wish. To have an email be stored with a certain template, simply send your email with an X-Save-Mail-Template header (as seen below). This will save the message with the specified template

X-Save-Mail-Template: preserve-headers

The message will be saved with the template preserve-headers.html.erb.

Other Services

Although this code is meant for the SendGrid Parse Webhook, it should also work with a few other services, with limited changes: (Warning: These have not been tested)

  • Mandrill should work without modification
  • zapier might work, but they sure do hide their documentation. Make sure html and headers parameters are POSTed as a form.
  • cloudmailin change params[:headers] to params[:message] and use their original HTTP POST format.
  • mailgun change Mail.new(params[:headers]) to simply params[:message-headers]

License

This code is licensed MIT. Please, build things with it.

sendy's People

Contributors

apoorvanand avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.