@openneuro/server 4.4.0-alpha.4 → 4.4.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/server",
3
- "version": "4.4.0-alpha.4",
3
+ "version": "4.4.0-alpha.5",
4
4
  "description": "Core service for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "src/server.js",
@@ -105,5 +105,5 @@
105
105
  "publishConfig": {
106
106
  "access": "public"
107
107
  },
108
- "gitHead": "e6fae8f69ec77f67577425dd839c27a36cce409e"
108
+ "gitHead": "5770bfd37c3f8883f99e65059ec5d57130c25a64"
109
109
  }
package/src/config.js CHANGED
@@ -42,10 +42,8 @@ const config = {
42
42
  },
43
43
  notifications: {
44
44
  email: {
45
- service: process.env.CRN_SERVER_MAIL_SERVICE,
46
- user: process.env.CRN_SERVER_MAIL_USER,
47
- url: process.env.CRN_SERVER_MAIL_URL,
48
- pass: process.env.CRN_SERVER_MAIL_PASS,
45
+ apiKey: process.env.CRN_SERVER_MAIL_API_KEY,
46
+ secret: process.env.CRN_SERVER_MAIL_API_SECRET,
49
47
  from: process.env.CRN_SERVER_MAIL_FROM,
50
48
  },
51
49
  },
@@ -1,33 +1,25 @@
1
1
  import nodemailer from 'nodemailer'
2
+ import mailjetTransport from 'nodemailer-mailjet-transport'
2
3
  import config from '../../config'
3
4
 
4
5
  // setup email transporter
5
- const transporter = nodemailer.createTransport({
6
- service: config.notifications.email.service,
7
- auth: {
8
- user:
9
- config.notifications.email.user + '@' + config.notifications.email.url,
10
- pass: config.notifications.email.pass,
11
- },
12
- })
6
+ const transporter = nodemailer.createTransport(
7
+ mailjetTransport({
8
+ auth: {
9
+ apiKey: config.notifications.email.apiKey,
10
+ secret: config.notifications.email.secret,
11
+ },
12
+ }),
13
+ )
13
14
 
14
15
  export const send = (
15
16
  email: Record<string, string>,
16
17
  callback: (err, response) => void,
17
18
  ): void => {
18
- // inline styles
19
- //html = juice(html)
20
-
21
- // determine if the main is from a specific sender
22
- // or the generic email address
23
- const user: string =
24
- email && email.from ? email.from : config.notifications.email.user
25
- const from = user + '@' + config.notifications.email.url
26
-
27
19
  // configure mail options
28
20
  const mailOptions = {
29
21
  from: `"OpenNeuro" <${config.notifications.email.from}>`,
30
- replyTo: from,
22
+ replyTo: config.notifications.email.from,
31
23
  to: email.to,
32
24
  subject: email.subject,
33
25
  html: email.html,