diff --git a/compute/mailjet.js b/compute/mailjet.js index 5ad072be17c..cbbb735cf29 100644 --- a/compute/mailjet.js +++ b/compute/mailjet.js @@ -20,19 +20,15 @@ // [START compute_send] const mailer = require('nodemailer'); -const smtp = require('nodemailer-smtp-transport'); - async function mailjet() { - const transport = mailer.createTransport( - smtp({ - host: 'in.mailjet.com', - port: 2525, - auth: { - user: process.env.MAILJET_API_KEY || '', - }, - }) - ); + const transport = mailer.createTransport({ + host: 'in.mailjet.com', + port: 2525, + auth: { + user: process.env.MAILJET_API_KEY || '', + pass: process.env.MAILJET_API_SECRET || '', + }, + }); const json = await transport.sendMail({ from: 'ANOTHER_EMAIL@ANOTHER_EXAMPLE.COM', // From address diff --git a/compute/package.json b/compute/package.json index e8a4b1cabbf..aa7ef5ae9fd 100644 --- a/compute/package.json +++ b/compute/package.json @@ -16,8 +16,7 @@ "dependencies": { "@google-cloud/compute": "^4.0.0", "@sendgrid/mail": "^8.0.0", - "nodemailer": "^6.0.0", - "nodemailer-smtp-transport": "^2.7.4", + "nodemailer": "^9.0.0", "sinon": "^19.0.2" }, "devDependencies": { diff --git a/compute/test/mailjet.test.js b/compute/test/mailjet.test.js index b2de020f902..e718256543d 100644 --- a/compute/test/mailjet.test.js +++ b/compute/test/mailjet.test.js @@ -24,8 +24,15 @@ describe('mailjet', () => { it('should send an email', () => { proxyquire('../mailjet', { nodemailer: { - createTransport: arg => { - assert.strictEqual(arg, 'test'); + createTransport: options => { + assert.deepStrictEqual(options, { + host: 'in.mailjet.com', + port: 2525, + auth: { + user: 'foo', + pass: 'bar', + }, + }); return { sendMail: payload => { assert.deepStrictEqual(payload, { @@ -39,17 +46,6 @@ describe('mailjet', () => { }; }, }, - 'nodemailer-smtp-transport': options => { - assert.deepStrictEqual(options, { - host: 'in.mailjet.com', - port: 2525, - auth: { - user: 'foo', - pass: 'bar', - }, - }); - return 'test'; - }, }); }); });