diff --git a/README.md b/README.md
index 50fb96a59..c25f5a177 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ Add the following to your `package.json` file:
...
"dependencies": {
...
- "sendgrid": "0.4.3"
+ "sendgrid": "0.4.4"
}
}
```
@@ -202,6 +202,30 @@ email.setFrom('foo@bar.com');
sendgrid.send(email, function(err, json) { });
```
+#### setSubject
+
+```javascript
+var email = new Email();
+email.setFrom('foo@bar.com');
+sendgrid.send(email, function(err, json) { });
+```
+
+#### setText
+
+```javascript
+var email = new Email();
+email.setText('Some text');
+sendgrid.send(email, function(err, json) { });
+```
+
+#### setHtml
+
+```javascript
+var email = new Email();
+email.setHtml('
Some html
');
+sendgrid.send(email, function(err, json) { });
+```
+
#### setHeaders
You can set custom headers.
diff --git a/lib/email.js b/lib/email.js
index 80801d5cd..9e5f20428 100644
--- a/lib/email.js
+++ b/lib/email.js
@@ -87,6 +87,18 @@ Email.prototype.setFrom = function(from) {
this.from = from;
};
+Email.prototype.setSubject = function(subject) {
+ this.subject = subject;
+};
+
+Email.prototype.setText = function(text) {
+ this.text = text;
+};
+
+Email.prototype.setHtml = function(html) {
+ this.html = html;
+};
+
/**
* This method is a proxy for the add sub val on the SmtpapiHeaders
*
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
new file mode 100644
index 000000000..6b1f8d030
--- /dev/null
+++ b/npm-shrinkwrap.json
@@ -0,0 +1,171 @@
+{
+ "name": "sendgrid",
+ "version": "0.4.4",
+ "dependencies": {
+ "nodemailer": {
+ "version": "0.4.4",
+ "from": "nodemailer@0.4.4",
+ "dependencies": {
+ "mailcomposer": {
+ "version": "0.1.34",
+ "from": "mailcomposer@~0.1",
+ "dependencies": {
+ "mimelib": {
+ "version": "0.2.14",
+ "from": "mimelib@~0.2",
+ "dependencies": {
+ "encoding": {
+ "version": "0.1.7",
+ "from": "encoding@~0.1",
+ "dependencies": {
+ "iconv-lite": {
+ "version": "0.2.11",
+ "from": "iconv-lite@~0.2.11"
+ }
+ }
+ },
+ "addressparser": {
+ "version": "0.2.0",
+ "from": "addressparser@~0.2.0"
+ }
+ }
+ }
+ }
+ },
+ "simplesmtp": {
+ "version": "0.3.13",
+ "from": "simplesmtp@~0.2 || ~0.3",
+ "dependencies": {
+ "rai": {
+ "version": "0.1.7",
+ "from": "rai@~0.1"
+ },
+ "xoauth2": {
+ "version": "0.1.8",
+ "from": "xoauth2@~0.1"
+ }
+ }
+ }
+ }
+ },
+ "mime": {
+ "version": "1.2.9",
+ "from": "mime@1.2.9"
+ },
+ "request": {
+ "version": "2.22.0",
+ "from": "request@2.22.0",
+ "resolved": "https://registry.npmjs.org/request/-/request-2.22.0.tgz",
+ "dependencies": {
+ "qs": {
+ "version": "0.6.5",
+ "from": "qs@~0.6.0"
+ },
+ "json-stringify-safe": {
+ "version": "4.0.0",
+ "from": "json-stringify-safe@~4.0.0"
+ },
+ "forever-agent": {
+ "version": "0.5.0",
+ "from": "forever-agent@~0.5.0"
+ },
+ "tunnel-agent": {
+ "version": "0.3.0",
+ "from": "tunnel-agent@~0.3.0"
+ },
+ "http-signature": {
+ "version": "0.10.0",
+ "from": "http-signature@~0.10.0",
+ "dependencies": {
+ "assert-plus": {
+ "version": "0.1.2",
+ "from": "assert-plus@0.1.2"
+ },
+ "asn1": {
+ "version": "0.1.11",
+ "from": "asn1@0.1.11"
+ },
+ "ctype": {
+ "version": "0.5.2",
+ "from": "ctype@0.5.2"
+ }
+ }
+ },
+ "hawk": {
+ "version": "0.13.1",
+ "from": "hawk@~0.13.0",
+ "dependencies": {
+ "hoek": {
+ "version": "0.8.5",
+ "from": "hoek@0.8.x"
+ },
+ "boom": {
+ "version": "0.4.2",
+ "from": "boom@0.4.x",
+ "dependencies": {
+ "hoek": {
+ "version": "0.9.1",
+ "from": "hoek@0.9.x"
+ }
+ }
+ },
+ "cryptiles": {
+ "version": "0.2.2",
+ "from": "cryptiles@0.2.x"
+ },
+ "sntp": {
+ "version": "0.2.4",
+ "from": "sntp@0.2.x",
+ "dependencies": {
+ "hoek": {
+ "version": "0.9.1",
+ "from": "hoek@0.9.x"
+ }
+ }
+ }
+ }
+ },
+ "aws-sign": {
+ "version": "0.3.0",
+ "from": "aws-sign@~0.3.0"
+ },
+ "oauth-sign": {
+ "version": "0.3.0",
+ "from": "oauth-sign@~0.3.0"
+ },
+ "cookie-jar": {
+ "version": "0.3.0",
+ "from": "cookie-jar@~0.3.0"
+ },
+ "node-uuid": {
+ "version": "1.4.1",
+ "from": "node-uuid@~1.4.0"
+ },
+ "form-data": {
+ "version": "0.0.8",
+ "from": "form-data@0.0.8",
+ "dependencies": {
+ "combined-stream": {
+ "version": "0.0.4",
+ "from": "combined-stream@~0.0.4",
+ "dependencies": {
+ "delayed-stream": {
+ "version": "0.0.5",
+ "from": "delayed-stream@0.0.5"
+ }
+ }
+ },
+ "async": {
+ "version": "0.2.9",
+ "from": "async@~0.2.7"
+ }
+ }
+ }
+ }
+ },
+ "lodash": {
+ "version": "2.0.0",
+ "from": "lodash@2.0.0"
+ }
+ }
+}
diff --git a/package.json b/package.json
index b254aeef2..adbcf973b 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
],
"name": "sendgrid",
"description": "A NodeJS implementation of the SendGrid Api.",
- "version": "0.4.3",
+ "version": "0.4.4",
"homepage": "http://sendgrid.com",
"repository": {
"type": "git",
diff --git a/test/lib/email.test.js b/test/lib/email.test.js
index d83dcdb74..ca9c69851 100644
--- a/test/lib/email.test.js
+++ b/test/lib/email.test.js
@@ -200,6 +200,28 @@ describe('Email', function () {
expect(email.from).to.eql('kyle.partridge@sendgrid.com');
});
+ it('should be possible to setSubject', function() {
+ var email = new Email();
+ expect(email.subject).to.be.empty;
+ email.setSubject('A subject');
+ expect(email.subject).to.eql('A subject');
+ });
+
+ it('should be possible to setText', function() {
+ var email = new Email();
+ expect(email.text).to.be.empty;
+ email.setText('Some text');
+ expect(email.text).to.eql('Some text');
+ });
+
+ it('should be possible to setHtml', function() {
+ var email = new Email();
+ expect(email.html).to.be.empty;
+ email.setHtml('Some html
');
+ expect(email.html).to.eql('Some html
');
+ });
+
+
describe('files', function() {
it('should support adding attachments via path', function() {
var email = new Email();
diff --git a/test/lib/sendgrid.test.js b/test/lib/sendgrid.test.js
index e95989a22..c1bebeb0e 100644
--- a/test/lib/sendgrid.test.js
+++ b/test/lib/sendgrid.test.js
@@ -19,7 +19,7 @@ describe('SendGrid', function () {
});
it('version should be set', function() {
- expect(sendgrid.version).to.equal("0.4.3");
+ expect(sendgrid.version).to.equal("0.4.4");
});
it('should attach a options object to self', function() {