summaryrefslogtreecommitdiffstats
path: root/lib/sendgrid.js
diff options
context:
space:
mode:
authorscottmotte <scott@scottmotte.com>2013-12-18 15:14:38 -0800
committerscottmotte <scott@scottmotte.com>2013-12-18 15:14:38 -0800
commit8c6cc2b176a4e4bd643ad15dbfba95b0f5c2d2df (patch)
treebe221943bd74b6666ca9d7607d4e185430d433de /lib/sendgrid.js
parent358aa84582737ccee7ac60592bbb1b949ca8b84f (diff)
downloadsendgrid-nodejs-8c6cc2b176a4e4bd643ad15dbfba95b0f5c2d2df.zip
sendgrid-nodejs-8c6cc2b176a4e4bd643ad15dbfba95b0f5c2d2df.tar.gz
sendgrid-nodejs-8c6cc2b176a4e4bd643ad15dbfba95b0f5c2d2df.tar.bz2
SMTP removed
Diffstat (limited to 'lib/sendgrid.js')
-rw-r--r--lib/sendgrid.js70
1 files changed, 0 insertions, 70 deletions
diff --git a/lib/sendgrid.js b/lib/sendgrid.js
index 637b6a2..96126b9 100644
--- a/lib/sendgrid.js
+++ b/lib/sendgrid.js
@@ -1,7 +1,6 @@
"use strict";
var package_json = require('./../package.json');
-var nodemailer = require('nodemailer');
var _ = require('lodash');
var request = require('request');
var Email = require('./email');
@@ -18,11 +17,6 @@ var Sendgrid = function(api_user, api_key, options) {
this.options.port = this.options.port || 587;
var send = function() {
- if ( _this.options.api === 'smtp') {
- smtp.apply(this, arguments);
- return true;
- }
-
web.apply( this, arguments );
};
@@ -45,34 +39,6 @@ var Sendgrid = function(api_user, api_key, options) {
}.bind(this);
/*
- * Sends an email via SMTP and returns true if the
- * message was sent successfully.
- *
- * @param {Email|Object} email An email object or a hash that has
- * the values for the email to be sent.
- * @param {Object} nodeMailerOptions Extra options for nodeMailer. i.e. Message-Id
- * This parameter is optional.
- * @param {Function} callback A function to call when the processing is done.
- * This parameter is optional.
- */
- var smtp = function(email, nodeMailerOptions, callback) {
-
- // Support a callback without nodeMailerOptions
- if (! callback && typeof nodeMailerOptions === "function") {
- callback = nodeMailerOptions;
- nodeMailerOptions = null;
- }
-
- var callback = callback || function() { };
-
- if (email.constructor !== Email) {
- email = new Email(email);
- }
-
- _sendSmtp(email, nodeMailerOptions, callback);
- };
-
- /*
* Psuedo-private methods
*/
var _sendWeb = function(email, callback) {
@@ -135,51 +101,15 @@ var Sendgrid = function(api_user, api_key, options) {
}
};
- var _sendSmtp = function(email, nodeMailerOptions, callback) {
- // SMTP settings
- var smtp_settings = {
- host: "smtp.sendgrid.net",
- port: parseInt(_this.port, 10),
- requiresAuth: true,
- auth: {
- user: api_user,
- pass: api_key
- }
- };
-
- if (smtp_settings.port == 465) {
- smtp_settings['secureConnection'] = true;
- }
-
- var smtpTransport = nodemailer.createTransport(_this.SMTP, smtp_settings);
-
- var smtpParams = email.toSmtpFormat();
-
- if (_.isObject(nodeMailerOptions)) {
- _.extend(smtpParams, nodeMailerOptions);
- }
-
- smtpTransport.sendMail(smtpParams, function(error, response) {
-
- smtpTransport.close();
- if(error) { return callback(new Error(error.message), null);}
-
- return callback(null, {'message': 'success'});
- });
- };
-
-
/*
* Expose public API calls
*/
this.version = package_json.version;
- this.SMTP = "SMTP";
this.Email = Email;
this.SmtpapiHeaders = SmtpapiHeaders;
this.api_user = api_user;
this.api_key = api_key;
this.web = web;
- this.smtp = smtp;
this.send = send;
this.options = this.options;
this.port = this.options.port;