summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/sendgrid.js2
-rw-r--r--test/integration/sendgrid.test.js10
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/sendgrid.js b/lib/sendgrid.js
index 3320b36..15fee86 100644
--- a/lib/sendgrid.js
+++ b/lib/sendgrid.js
@@ -116,7 +116,7 @@ SendGrid.prototype.smtp = function(email, callback) {
function send_smtp() {
smtpTransport.sendMail(email.toSmtpFormat(), function(err, response) {
smtpTransport.close();
- if(err) { return cb(error.data, null);}
+ if(err) { return cb(err.data, null);}
return cb(null, {'message': 'success'});
});
diff --git a/test/integration/sendgrid.test.js b/test/integration/sendgrid.test.js
index 5bb8734..c753798 100644
--- a/test/integration/sendgrid.test.js
+++ b/test/integration/sendgrid.test.js
@@ -360,12 +360,20 @@ describe('SendGrid #skip', function () {
var payload;
beforeEach(function() {
- sendgrid.SMTP = "STUB";
+ sendgrid.SMTP = "SMTP";
payload = Object.create(default_payload);
payload.subject += "smtp ";
});
+ it('has a blank send payload', function(done) {
+ sendgrid.smtp({}, function(err, json) {
+ expect(err).to.equal("501 Syntax error");
+
+ done();
+ });
+ });
+
it('has an optional callback', function(done) {
payload.subject += "has an optional callback";