summaryrefslogtreecommitdiffstats
path: root/lib/sendgrid.js
diff options
context:
space:
mode:
authorDavid Tomberlin <david.tomberlin@sendgrid.com>2012-01-11 15:13:31 -0800
committerDavid Tomberlin <david.tomberlin@sendgrid.com>2012-01-11 15:13:31 -0800
commit59ce3c683a2e81d1f9e0aa6ac97c66df7e6a21b7 (patch)
treeedb76784e8b72a459d963963caa904c00abfebba /lib/sendgrid.js
parentd262b7c00ffd95d15f770008bb2500e61f5dc1fe (diff)
downloadsendgrid-nodejs-59ce3c683a2e81d1f9e0aa6ac97c66df7e6a21b7.zip
sendgrid-nodejs-59ce3c683a2e81d1f9e0aa6ac97c66df7e6a21b7.tar.gz
sendgrid-nodejs-59ce3c683a2e81d1f9e0aa6ac97c66df7e6a21b7.tar.bz2
added logs/testing for further use
Diffstat (limited to 'lib/sendgrid.js')
-rw-r--r--lib/sendgrid.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/sendgrid.js b/lib/sendgrid.js
index 122a1a9..d5aed75 100644
--- a/lib/sendgrid.js
+++ b/lib/sendgrid.js
@@ -27,6 +27,7 @@ SendGrid.prototype.send = function(email, callback) {
'Content-Length': post_data.length
}
};
+ console.dir(post_data);
var request = https.request(options, function(res) {
res.setEncoding('utf8');
@@ -52,13 +53,19 @@ SendGrid.prototype.smtp = function(email, callback) {
};
email = email.params || email;
+ console.log('\t\t\t' + JSON.stringify(email['x-smtpapi'])
+);
nodemailer.send_mail({
sender: email.from,
to: email.to,
subject: email.subject,
body: email.text,
- html: email.html
+ html: email.html,
+ headers: {
+ "x-smtpapi": JSON.stringify(email['x-smtpapi'])
+ },
+ debug:true
}, function(error, success) {
callback.call(self, success, error);
});
@@ -70,7 +77,11 @@ SendGrid.prototype.getPostData = function(params) {
api_user: this.api_user,
api_key: this.api_key
}
+ console.log('\n\n\n\nhere is logging params');
_(params).each(function(v, k) {
+ console.log("value is %s and key is %s -> %s", v, k, _(v).isObject() );
+ if (_(v).isObject() && !_(v).isDate() && !_(v).isArray())
+ v = JSON.stringify(v);
data[k] = v;
});