Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated SMTP functions to use the newest version of the nodemailer API.

Nodemailer's API changed recently, so sending via SMTP will be broken
for anyone who installs the package in its current state.  Also, added a
shrinkwrap file to prevent this from happening in the future.
  • Loading branch information...
commit 132472912e42eba9b7cafe1ddab20d4a18cee7c4 1 parent 233ed85
@theycallmeswift theycallmeswift authored
Showing with 79 additions and 10 deletions.
  1. +15 −10 lib/sendgrid.js
  2. +64 −0 npm-shrinkwrap.json
View
25 lib/sendgrid.js
@@ -110,20 +110,25 @@ SendGrid.prototype.send = function(email, callback) {
* @param {Function} callback A function to call when the processing is done.
*/
SendGrid.prototype.smtp = function(email, callback) {
- var self = this;
+ var self = this
+ , smtpTransport;
// SMTP settings
- nodemailer.SMTP = {
- host: 'smtp.sendgrid.net',
- use_authentication: true,
- ssl: true,
- user: this.api_user,
- pass: this.api_key
- };
+ smtpTransport = nodemailer.createTransport("SMTP", {
+ service: 'SendGrid',
+ auth: {
+ user: this.api_user,
+ pass: this.api_key
+ }
+ });
function send_smtp() {
- nodemailer.send_mail(email.toSmtpFormat(), function(error, success) {
- callback(success, error);
+ smtpTransport.sendMail(email.toSmtpFormat(), function(error, response) {
+ smtpTransport.close();
+ if(error) {
+ return callback(false, response);
+ }
+ return callback(true, response);
});
}
View
64 npm-shrinkwrap.json
@@ -0,0 +1,64 @@
+{
+ "name": "sendgrid",
+ "version": "0.2.2",
+ "dependencies": {
+ "underscore": {
+ "version": "1.3.3"
+ },
+ "nodemailer": {
+ "version": "0.3.20",
+ "dependencies": {
+ "mailcomposer": {
+ "version": "0.1.14",
+ "dependencies": {
+ "mimelib-noiconv": {
+ "version": "0.1.7"
+ }
+ }
+ },
+ "simplesmtp": {
+ "version": "0.1.18",
+ "dependencies": {
+ "rai": {
+ "version": "0.1.6"
+ }
+ }
+ }
+ }
+ },
+ "mime": {
+ "version": "1.2.5"
+ },
+ "step": {
+ "version": "0.0.5"
+ },
+ "chai": {
+ "version": "1.0.4"
+ },
+ "mocha": {
+ "version": "1.2.0",
+ "dependencies": {
+ "commander": {
+ "version": "0.5.2"
+ },
+ "growl": {
+ "version": "1.5.1"
+ },
+ "jade": {
+ "version": "0.20.3",
+ "dependencies": {
+ "mkdirp": {
+ "version": "0.3.3"
+ }
+ }
+ },
+ "diff": {
+ "version": "1.0.2"
+ },
+ "debug": {
+ "version": "0.7.0"
+ }
+ }
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.