Code Monkey home page Code Monkey logo

dewmail's Introduction

Dewmail

An open-source email parsing microservice for HTTP APIs. Written in Go. Receive email at your project's email address and automatically initiate a JSON formatted POST request to your app's existing API.

Use

Dewmail will receive emails on behalf of your domain and initiate a JSON encoded POST request to your API. Let's look at a specific example to cover some of the implementation details.

First, create the following MX records for your domain example.com

	TYPE|SUBDOMAIN|MAILSERVER HOST|PREF|TTL
	----|---------|---------------|----|---
	MX|api|in1.dewmail.org.|10|300
	MX|api|in2.dewmail.org.|20|300

You may then send an email from any client--for example, consider the following message.

To: [email protected]
Subject: mail
Body: unsubscribe

Dewmail will receive and parse your email generating the following JSON request {"body":"unsubscribe","from":"[email protected]","sender-IP":"12.34.56.78","spf":"Pass","subject":"mail","time":"2015-01-17T08:00:39Z","to":"[email protected]"}, which it will submit to http://api.example.com/foo/bar. Your API can then parse the message however you see fit.

Demo

For a demo, send an email to [email protected] and go to http://dewmail.org/demo.php.

Install

  1. Add the following MX record to the domain you wish to receive calls from Dewmail.

     TYPE|SUBDOMAIN|MAILSERVER HOST|PREF|TTL
     ----|---------|---------------|----|---
     MX|somesubdomain|in1.dewmail.org.|10|300
     MX|somesubdomain|in2.dewmail.org.|20|300
    

    Note: this will be the domain of the email address you must receive messages at and also the domain Dewmail will POST to looking for your API.

  2. Pull down Dewmail binary or build from source.

  3. Optional, add site to webserver if you want a way to query app status via HTTP. A sample Apache .htaccess file is provided to proxy requests for /up to the Dewmail app and will display a message if the service is up.

  4. Make sure port 25 isn't blocked by your firewall.

  5. Start Dewmail.

  6. Start sending emails.

Configuration

The previous example describes the default setup. There are a few options that may be configured for your particular setup. The following options can be set in the master configuration file config.go.

Option Type Function
OptDomainCheckingOn bool If true, will enforce only accepting mail for specific domains in OptValidDomains. Default, off, false.
OptValidDomains []string Domain(s) to accept emails for. By default, not used.
OptAPIRoute string Route for Dewmail to POST to (with leading and trailing slashes). Default, /.
OptToHTTPS bool Whether to use HTTPS/HTTP for POST request. Default, HTTP, false.
OptDataStoreUrl string URL to backend datastore. All messages for all domains will be POSTed here as well. Default, none, "".
OptDataStoreCountUrl string URL to backend datastore message sent count. All messages for all domains will increment this. Default, none, "".
OptHTTPPort string HTTP port number for serving web requests. Default, 8111.
OptSPFCheck bool Whether we should check SPF validation. Default, false.
OptRequireSPFPass bool Whether we should abort on SPF anything but pass. Default, false.
OptSPFAPI string Domain of API to check SPF results from. Default, "".
OptSPFAPIKey string API key for SPF validation system. Default, "".

dewmail's People

Contributors

withaspark 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.