Permalink
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...
1 parent 233ed85 commit 132472912e42eba9b7cafe1ddab20d4a18cee7c4 @theycallmeswift theycallmeswift committed Jun 21, 2012
Showing with 79 additions and 10 deletions.
  1. +15 −10 lib/sendgrid.js
  2. +64 −0 npm-shrinkwrap.json
View
@@ -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

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 1324729

Please sign in to comment.