summaryrefslogtreecommitdiffstats
path: root/lib/sendgrid.js
diff options
context:
space:
mode:
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;
});