Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"lodash": "^3.9.3",
"markdown": "^0.5.0",
"material-ui": "^0.15.1",
"nodemailer": "^2.4.2",
"nodemailer": "^4.0.1",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This upgrade to nodemailer v4 is a major version bump and introduces breaking changes. The existing code that uses this package, located in server/app/routes/api/v1/assessments/assessments.js, is not compatible with this new version and will break the email functionality.

To fix this, you'll need to make the following changes:

  1. Update nodemailer initialization: sendMail now returns a promise by default in v4, so Promise.promisifyAll is no longer necessary.
  2. Remove nodemailer-smtp-transport: This package (on line 60) is deprecated. Its functionality is now built into nodemailer. You should remove it from the dependencies.
  3. Update transport creation: The transport creation logic needs to be updated to match the v4 API.

Here is an example of how to update server/app/routes/api/v1/assessments/assessments.js:

// In server/app/routes/api/v1/assessments/assessments.js

// Replace these lines:
// const nodemailer = Promise.promisifyAll(require("nodemailer"));
// const smtpTransport = require("nodemailer-smtp-transport")
// const transport = nodemailer.createTransport(smtpTransport(`smtps://${GMAIL_ID}:${GMAIL_PASSWORD}@smtp.gmail.com`));

// With:
const nodemailer = require("nodemailer");
const transport = nodemailer.createTransport({
    service: 'gmail',
    auth: {
        user: GMAIL_ID,
        pass: GMAIL_PASSWORD
    }
});

Without these changes, the application will fail to send emails after this dependency upgrade.

"nodemailer-smtp-transport": "^2.5.0",
"nodemon": "^1.3.7",
"passport": "^0.2.1",
Expand Down