Coder Social home page Coder Social logo

mime-js's Introduction

mime-js

Sometimes you need to create MIME message in browser. With mime-js you can create expected MIME message text. This project is created with Play framework, sbt.

Usage

Call createMimeMessage function with mail object:

var mail = {  
    "to": "[email protected], [email protected]",
    "subject": "Today is rainy",
    "fromName": "John Smith",
    "from": "[email protected]",
    "body": "Sample body text",
    "cids": [],
    "attaches" : []
}
createMimeMessage(mail);

Result:

MIME-Version: 1.0
Date: Sat, 18 Oct 2014 10:33:33 +0000
Delivered-To: [email protected]
Message-ID: <[email protected]>
Subject: =?UTF-8?B?VG9kYXkgaXMgcmFpbnk=?=
From: =?UTF-8?B?Sm9obiBTbWl0aA==?= <[email protected]>
To: [email protected]
Content-Type: multipart/mixed; boundary=ko4nd8p2ef2bj4i29277j78q0azto6r

--ko4nd8p2ef2bj4i29277j78q0azto6r
Content-Type: multipart/related; boundary=lwayf4vfgfhcl3dipsq6t2hoaa2rcnmi

--lwayf4vfgfhcl3dipsq6t2hoaa2rcnmi
Content-Type: multipart/alternative; boundary=6ghtwcxztyidaemiv0gzjnw8un8z1tt9

--6ghtwcxztyidaemiv0gzjnw8un8z1tt9
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64

U2FtcGxlIGJvZHkgdGV4dA==

--6ghtwcxztyidaemiv0gzjnw8un8z1tt9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: base64

PGRpdj5TYW1wbGUgYm9keSB0ZXh0PC9kaXY+

--6ghtwcxztyidaemiv0gzjnw8un8z1tt9--
--lwayf4vfgfhcl3dipsq6t2hoaa2rcnmi--
--ko4nd8p2ef2bj4i29277j78q0azto6r--

cids - For inline images
attaches - any file in base64 format

You may need to look into mime-js.coffee (mime-js.js)

mime-js's People

Watchers

 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.