Giter Site home page Giter Site logo

sendit's Introduction

Tsushin - Communication server

This application provides a central, template-based email delivery service.

Templates are editable and available at /templates. From- and subject-fields as well as plain text and html message bodies are all evaluated as ERB with the supplied JSON document as the binding (i.e. data defined in the JSON document is accesible as instance variables inside the ERB).

To send email based on a given template you should POST a json document to /send/:template_name.

Example

Given a template (let's assume that it is saved with the name test.template) with the following definitions:

From:

<%= @from %>

Subject:

<%= @subject %>

Plain:

This is the plain text part.
The time now is <%= Time.now %>.
The contents of the "test" variable is: <%= @test %>.

HTML:

<html><body>
<p>This is the html part.</p>
<p>The time now is <%= Time.now %>.</p>
<p>The contents of the "test" variable is: <code><%= @test %></code></p>
</body></html>

Posting the following json to /send/test.template

{ "to": "[email protected]", "from": "[email protected]", subject": "Read this", test": "Hello world!" }

Will generate the following email message

Date: Tue, 11 Jun 2013 08:30:10 +0200
From: [email protected]
To: [email protected]
Message-ID: <[email protected]>
Subject: Read this
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_51b6c3f2a80dd_12cec3fe33f693e005865d";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_51b6c3f2a80dd_12cec3fe33f693e005865d
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

This is the plain text part.
The time now is 2013-06-11 08:30:10 +0200.
The contents of the "test" variable is: Hello world!.

----==_mimepart_51b6c3f2a80dd_12cec3fe33f693e005865d
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<html><body>
<p>This is the html part.</p>
<p>The time now is 2013-06-11 08:30:10 +0200.</p>
<p>The contents of the "test" variable is: <code>Hello world!</code></p>
</body></html>
----==_mimepart_51b6c3f2a80dd_12cec3fe33f693e005865d--

and send it to [email protected].

Access control.

Authentication and authorization for template editing is done by CAS.

Authentication for the send API is IP based.

sendit's People

Contributors

mortenroenne avatar viktorsmari avatar troelslisberg avatar jipe avatar

Watchers

Jonas Munk avatar James Cloos avatar  avatar  avatar  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.