diff options
-rw-r--r-- | lib/email.js | 4 | ||||
-rw-r--r-- | test/lib/email.test.js | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/email.js b/lib/email.js index d610661..80801d5 100644 --- a/lib/email.js +++ b/lib/email.js @@ -83,6 +83,10 @@ Email.prototype.addTo = function(to) { this.smtpapi.addTo(to); }; +Email.prototype.setFrom = function(from) { + this.from = from; +}; + /** * This method is a proxy for the add sub val on the SmtpapiHeaders * diff --git a/test/lib/email.test.js b/test/lib/email.test.js index b850286..d83dcdb 100644 --- a/test/lib/email.test.js +++ b/test/lib/email.test.js @@ -193,6 +193,13 @@ describe('Email', function () { }); }); + it('should be possible to setFrom', function() { + var email = new Email(); + expect(email.from).to.be.empty; + email.setFrom('kyle.partridge@sendgrid.com'); + expect(email.from).to.eql('kyle.partridge@sendgrid.com'); + }); + describe('files', function() { it('should support adding attachments via path', function() { var email = new Email(); |