Skip to content

Commit

Permalink
Merge pull request #1 from varanauskas/master
Browse files Browse the repository at this point in the history
Isolate SendGrid MailService used, so it does not use the global one nodemailer#14
  • Loading branch information
Yhozen authored Jun 22, 2023
2 parents 54dc309 + f286333 commit c73d2d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
'use strict';

const packageData = require('./package.json');
const sgMail = require('@sendgrid/mail');
const { MailService } = require('@sendgrid/mail');

class SendGridTransport {
constructor(options) {
this.options = options || {};
this.name = packageData.name;
this.version = packageData.version;
this.sgMail = new MailService();
if (options.apiKey) {
sgMail.setApiKey(options.apiKey);
this.sgMail.setApiKey(options.apiKey);
}
}

Expand Down Expand Up @@ -123,7 +124,7 @@ class SendGridTransport {
}
}

sgMail.send(msg, callback);
this.sgMail.send(msg, callback);
});
}
}
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
"scripts": {
"test": "grunt"
},
"keywords": ["nodemailer", "sendgrid"],
"keywords": [
"nodemailer",
"sendgrid"
],
"author": "Andris Reinman",
"license": "MIT",
"dependencies": {
"@sendgrid/mail": "^6.2.1"
"@sendgrid/mail": "^7.4.4"
},
"devDependencies": {
"eslint-config-nodemailer": "^1.2.0",
"grunt": "^1.0.2",
"grunt-eslint": "^20.1.0",
"nodemailer": "^4.6.3"
"grunt-eslint": "^23.0.0",
"nodemailer": "^6.6.1"
}
}

0 comments on commit c73d2d8

Please sign in to comment.