Skip to content

Commit 985f836

Browse files
committed
Move to emailjs repo
1 parent 555cb9a commit 985f836

File tree

8 files changed

+151
-199
lines changed

8 files changed

+151
-199
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
language: node_js
2+
sudo: false
23
node_js:
3-
- "0.10"
4-
- "0.11"
4+
- 4.1
55
before_install:
66
- npm install -g grunt-cli
77
notifications:
88
email:
9-
- build@whiteout.io
9+
recipients:
10+
- felix.hammerl@gmail.com
11+
- andris.reinman@gmail.com

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# mailbuild
1+
# emailjs-mime-builder
22

3-
*mailbuild* is a low level rfc2822 message composer. Define your own mime tree, no magic included.
3+
*emailjs-mime-builder* is a low level rfc2822 message composer. Define your own mime tree, no magic included.
44

5-
[![Build Status](https://travis-ci.org/whiteout-io/mailbuild.png?branch=master)](https://travis-ci.org/whiteout-io/mailbuild)
5+
[![Build Status](https://travis-ci.org/emailjs/emailjs-mime-builder.png?branch=master)](https://travis-ci.org/emailjs/emailjs-mime-builder)
66

77
## StringEncoding API
88

@@ -18,18 +18,18 @@ This module requires `TextEncoder` and `TextDecoder` to exist as part of the Str
1818

1919
This module has dependencies that will be fetched automatically.
2020

21-
* [mimefuncs](https://github.com/whiteout-io/mimefuncs/)
22-
* [mimetypes](https://github.com/whiteout-io/mimetypes/)
23-
* [addressparser](https://github.com/whiteout-io/addressparser/)
21+
* [emailjs-mime-codec](https://github.com/emailjs/emailjs-mime-codec/)
22+
* [emailjs-mime-types](https://github.com/emailjs/emailjs-mime-types/)
23+
* [emailjs-addressparser](https://github.com/emailjs/emailjs-addressparser/)
2424
* [punycode.js](https://github.com/bestiejs/punycode.js)
25-
* [stringencoding](https://github.com/whiteout-io/stringencoding)
25+
* [emailjs-stringencoding](https://github.com/emailjs/emailjs-stringencoding)
2626

2727
## API
2828

29-
Create a new `Mailbuild` object with
29+
Create a new `MimeBuilder` object with
3030

3131
```javascript
32-
var builder = new Mailbuild(contentType [, options]);
32+
var builder = new MimeBuilder(contentType [, options]);
3333
```
3434

3535
Where
@@ -41,7 +41,7 @@ Where
4141

4242
## Methods
4343

44-
The same methods apply to the root node created with `new Mailbuild()` and to any child nodes.
44+
The same methods apply to the root node created with `new MimeBuilder()` and to any child nodes.
4545

4646
### createChild
4747

@@ -51,12 +51,12 @@ Creates and appends a child node to the node object
5151
node.createChild(contentType, options)
5252
```
5353

54-
The same arguments apply as with `new Mailbuild()`. Created node object is returned.
54+
The same arguments apply as with `new MimeBuilder()`. Created node object is returned.
5555

5656
**Example**
5757

5858
```javascript
59-
new Mailbuild("multipart/mixed").
59+
new MimeBuilder("multipart/mixed").
6060
createChild("multipart/related").
6161
createChild("text/plain");
6262
```
@@ -86,8 +86,8 @@ Method returns appended child node.
8686
**Example**
8787

8888
```javascript
89-
var childNode = new Mailbuild("text/plain"),
90-
rootNode = new Mailbuild("multipart/mixed");
89+
var childNode = new MimeBuilder("text/plain"),
90+
rootNode = new MimeBuilder("multipart/mixed");
9191
rootnode.appendChild(childNode);
9292
```
9393

@@ -115,9 +115,9 @@ Method returns replacement node.
115115
**Example**
116116

117117
```javascript
118-
var rootNode = new Mailbuild("multipart/mixed"),
118+
var rootNode = new MimeBuilder("multipart/mixed"),
119119
childNode = rootNode.createChild("text/plain");
120-
childNode.replace(new Mailbuild("text/html"));
120+
childNode.replace(new MimeBuilder("text/html"));
121121
```
122122

123123
Generates the following mime tree:
@@ -141,7 +141,7 @@ Method returns removed node.
141141

142142
```javascript
143143

144-
var rootNode = new Mailbuild("multipart/mixed"),
144+
var rootNode = new MimeBuilder("multipart/mixed"),
145145
childNode = rootNode.createChild("text/plain");
146146
childNode.remove();
147147
```
@@ -173,7 +173,7 @@ Method returns current node.
173173
**Example**
174174

175175
```javascript
176-
new Mailbuild("text/plain").
176+
new MimeBuilder("text/plain").
177177
setHeader("content-disposition", "inline").
178178
setHeader({
179179
"content-transfer-encoding": "7bit"
@@ -214,7 +214,7 @@ Method returns current node.
214214
**Example**
215215

216216
```javascript
217-
new Mailbuild("text/plain").
217+
new MimeBuilder("text/plain").
218218
addHeader("X-Spam", "1").
219219
setHeader({
220220
"x-spam": "2"
@@ -248,7 +248,7 @@ Where
248248
**Example**
249249

250250
```javascript
251-
new Mailbuild("text/plain").getHeader("content-type"); // text/plain
251+
new MimeBuilder("text/plain").getHeader("content-type"); // text/plain
252252
```
253253

254254
## setContent
@@ -267,7 +267,7 @@ Where
267267
**Example**
268268

269269
```javascript
270-
new Mailbuild("text/plain").setContent("Hello world!");
270+
new MimeBuilder("text/plain").setContent("Hello world!");
271271
```
272272

273273
## build
@@ -283,7 +283,7 @@ Method returns the rfc2822 message as a string
283283
**Example**
284284

285285
```javascript
286-
new Mailbuild("text/plain").setContent("Hello world!").build();
286+
new MimeBuilder("text/plain").setContent("Hello world!").build();
287287
```
288288

289289
Returns the following string:
@@ -310,7 +310,7 @@ Method returns the envelope in the form of `{from:'address', to: ['addresses']}`
310310
**Example**
311311

312312
```javascript
313-
new Mailbuild().
313+
new MimeBuilder().
314314
addHeader({
315315
from: "From <from@example.com>",
316316
to: "receiver1@example.com",
@@ -340,7 +340,7 @@ the addresses are converted to punycode automatically.
340340
For attachments you should minimally set `filename` option and `Content-Disposition` header. If filename is specified, you can leave content type blank - if content type is not set, it is detected from the filename.
341341

342342
```javascript
343-
new Mailbuild("multipart/mixed").
343+
new MimeBuilder("multipart/mixed").
344344
createChild(false, {filename: "image.png"}).
345345
setHeader("Content-Disposition", "attachment");
346346
```

example/index.html

Lines changed: 0 additions & 14 deletions
This file was deleted.

example/index.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

package.json

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
{
2-
"name": "mailbuild",
3-
"version": "0.3.7",
4-
"homepage": "https://github.com/whiteout-io/mailbuild",
5-
"description": "mailbuild is a low level rfc2822 message composer. Define your own mime tree, no magic included.",
6-
"author": "Andris Reinman <andris@kreata.ee>",
7-
"keywords": [
8-
"RFC2822",
9-
"mime"
10-
],
11-
"license": "MIT",
12-
"scripts": {
13-
"test": "grunt"
14-
},
15-
"repository": {
16-
"type": "git",
17-
"url": "git://github.com/whiteout-io/mailbuild.git"
18-
},
19-
"main": "src/mailbuild",
20-
"dependencies": {
21-
"mimefuncs": "~0.3.5",
22-
"mimetypes": "~0.1.1",
23-
"wo-addressparser": "~0.1.3",
24-
"punycode": "~1.2.4"
25-
},
26-
"devDependencies": {
27-
"chai": "~1.8.1",
28-
"grunt": "~0.4.1",
29-
"grunt-mocha-phantomjs": "~0.4.0",
30-
"grunt-contrib-connect": "~0.6.0",
31-
"grunt-contrib-jshint": "~0.8.0",
32-
"grunt-mocha-test": "~0.10.0",
33-
"mocha": "~1.16.2",
34-
"phantomjs": "~1.9.7-1",
35-
"requirejs": "~2.1.10",
36-
"sinon": "^1.9.0",
37-
"amdefine": "^0.1.0"
38-
}
2+
"name": "emailjs-mime-builder",
3+
"version": "1.0.0",
4+
"homepage": "https://github.com/emailjs/emailjs-mime-builder",
5+
"description": "emailjs-mime-builder is a low level rfc2822 message composer. Define your own mime tree, no magic included.",
6+
"author": "Andris Reinman <andris@kreata.ee>",
7+
"keywords": [
8+
"RFC2822",
9+
"mime"
10+
],
11+
"license": "MIT",
12+
"scripts": {
13+
"test": "grunt"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git://github.com/emailjs/emailjs-mime-builder.git"
18+
},
19+
"main": "src/emailjs-mime-builder",
20+
"dependencies": {
21+
"emailjs-addressparser": "^1.0.1",
22+
"emailjs-mime-codec": "^1.0.1",
23+
"emailjs-mime-types": "^1.0.0",
24+
"punycode": "^1.4.0"
25+
},
26+
"devDependencies": {
27+
"amdefine": "^1.0.0",
28+
"chai": "^3.4.1",
29+
"grunt": "^0.4.5",
30+
"grunt-contrib-connect": "^0.11.2",
31+
"grunt-contrib-jshint": "^0.11.3",
32+
"grunt-mocha-phantomjs": "^2.0.1",
33+
"grunt-mocha-test": "^0.12.7",
34+
"mocha": "^2.3.4",
35+
"phantomjs": "^1.9.19",
36+
"requirejs": "^2.1.22",
37+
"sinon": "^1.17.2"
38+
}
3939
}

src/mailbuild.js renamed to src/emailjs-mime-builder.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
'use strict';
2323

2424
if (typeof define === 'function' && define.amd) {
25-
define(['mimefuncs', 'mimetypes', 'punycode', 'addressparser'], factory);
25+
define(['emailjs-mime-codec', 'emailjs-mime-types', 'punycode', 'emailjs-addressparser'], factory);
2626
} else if (typeof exports === 'object') {
27-
module.exports = factory(require('mimefuncs'), require('mimetypes'), require('punycode'), require('wo-addressparser'));
27+
module.exports = factory(require('emailjs-mime-codec'), require('emailjs-mime-types'), require('punycode'), require('emailjs-addressparser'));
2828
} else {
29-
root.mailbuild = factory(root.mimefuncs, root.mimetypes, root.punycode, root.addressparser);
29+
root['emailjs-mime-builder'] = factory(root['emailjs-mime-codec'], root['emailjs-mime-types'], root.punycode, root['emailjs-addressparser']);
3030
}
31-
}(this, function(mimefuncs, mimetypes, punycode, addressparser) {
31+
}(this, function(mimecodec, mimetypes, punycode, addressparser) {
3232
'use strict';
3333

3434
/**
@@ -372,14 +372,14 @@
372372

373373
switch (header.key) {
374374
case 'Content-Disposition':
375-
structured = mimefuncs.parseHeaderValue(value);
375+
structured = mimecodec.parseHeaderValue(value);
376376
if (this.filename) {
377377
structured.params.filename = this.filename;
378378
}
379379
value = this._buildHeaderValue(structured);
380380
break;
381381
case 'Content-Type':
382-
structured = mimefuncs.parseHeaderValue(value);
382+
structured = mimecodec.parseHeaderValue(value);
383383

384384
this._handleContentType(structured);
385385

@@ -407,7 +407,7 @@
407407
return;
408408
}
409409

410-
lines.push(mimefuncs.foldLines(key + ': ' + value, 76));
410+
lines.push(mimecodec.foldLines(key + ': ' + value, 76));
411411
}.bind(this));
412412

413413
// Ensure mandatory header fields
@@ -440,14 +440,14 @@
440440

441441
switch (transferEncoding) {
442442
case 'quoted-printable':
443-
lines.push(mimefuncs.quotedPrintableEncode(this.content));
443+
lines.push(mimecodec.quotedPrintableEncode(this.content));
444444
break;
445445
case 'base64':
446-
lines.push(mimefuncs.base64Encode(this.content, typeof this.content === 'object' && 'binary' || false));
446+
lines.push(mimecodec.base64Encode(this.content, typeof this.content === 'object' && 'binary' || false));
447447
break;
448448
default:
449449
if (flowed) {
450-
lines.push(mimefuncs.foldLines(this.content.replace(/\r?\n/g, '\r\n').
450+
lines.push(mimecodec.foldLines(this.content.replace(/\r?\n/g, '\r\n').
451451
// space stuffing http://tools.ietf.org/html/rfc3676#section-4.2
452452
replace(/^( |From|>)/igm, ' $1'),
453453
76, true));
@@ -544,7 +544,7 @@
544544
Object.keys(structured.params || {}).forEach(function(param) {
545545
// filename might include unicode characters so it is a special case
546546
if (param === 'filename') {
547-
mimefuncs.continuationEncode(param, structured.params[param], 50).forEach(function(encodedParam) {
547+
mimecodec.continuationEncode(param, structured.params[param], 50).forEach(function(encodedParam) {
548548
// continuation encoded strings are always escaped, so no need to use enclosing quotes
549549
// in fact using quotes might end up with invalid filenames in some clients
550550
paramsArray.push(encodedParam.key + '=' + encodedParam.value);
@@ -654,7 +654,7 @@
654654
default:
655655
value = (value || '').toString().replace(/\r?\n|\r/g, ' ');
656656
// mimeWordsEncode only encodes if needed, otherwise the original string is returned
657-
return mimefuncs.mimeWordsEncode(value, 'Q', 52);
657+
return mimecodec.mimeWordsEncode(value, 'Q', 52);
658658
}
659659
};
660660

@@ -673,7 +673,7 @@
673673
[].concat(addresses || []).forEach(function(address) {
674674
if (address.address) {
675675
address.address = address.address.replace(/^.*?(?=\@)/, function(user) {
676-
return mimefuncs.mimeWordsEncode(user, 'Q', 52);
676+
return mimecodec.mimeWordsEncode(user, 'Q', 52);
677677
}).replace(/@.+$/, function(domain) {
678678
return '@' + punycode.toASCII(domain.substr(1));
679679
});
@@ -706,7 +706,7 @@
706706
if (/^[\x20-\x7e]*$/.test(name)) {
707707
return '"' + name.replace(/([\\"])/g, '\\$1') + '"';
708708
} else {
709-
return mimefuncs.mimeWordEncode(name, 'Q', 52);
709+
return mimecodec.mimeWordEncode(name, 'Q', 52);
710710
}
711711
}
712712
return name;

0 commit comments

Comments
 (0)