Bläddra i källkod

:recycle: try different Brevo usage

dev
j 2 år sedan
förälder
incheckning
ff45f381d7
1 ändrade filer med 11 tillägg och 9 borttagningar
  1. 11
    9
      backend/lib/services/user.js

+ 11
- 9
backend/lib/services/user.js Visa fil

@@ -7,11 +7,13 @@ const Schmervice = require('@hapipal/schmervice')
7 7
 const SecurePassword = require('secure-password')
8 8
 
9 9
 // Configuration for Brevo
10
-const Brevo = require('@getbrevo/brevo')
11
-const apiInstance = new Brevo.TransactionalEmailsApi()
12
-const apiKey = apiInstance.apiClient.authentications['api-key']
13
-apiKey.apiKey = process.env.BREVO_KEY
14
-const sendSmtpEmail = new Brevo.SendSmtpEmail()
10
+const SibApiV3Sdk = require('@getbrevo/brevo')
11
+let apiInstance = new SibApiV3Sdk.AccountApi()
12
+apiInstance.setApiKey(
13
+    SibApiV3Sdk.AccountApiApiKeys.apiKey,
14
+    process.env.BREVO_KEY,
15
+)
16
+const sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail()
15 17
 
16 18
 // TODO: Consider implementing, nice use of SecurePassword,
17 19
 // but currently not used anywhere...
@@ -306,14 +308,14 @@ module.exports = class UserService extends Schmervice.Service {
306 308
             emailWasRespondedTo: false,
307 309
             accessToken: null,
308 310
         }
309
-        // NOTE: Although this looks messy, Brevo requries these
311
+        // NOTE: Although this looks messy, Brevo requires these
310 312
         // parameters be defined individually like this, attempts
311
-        // to configure this in a singel object cause errors on their API
313
+        // to configure this in a single object cause errors on their API
312 314
         sendSmtpEmail.sender = {
313
-            name: 'My Test Company',
315
+            name: '[siimee]',
314 316
             email: 'mytestemail@email.com',
315 317
         }
316
-        sendSmtpEmail.subject = 'My Test Company'
318
+        sendSmtpEmail.subject = '[siimee] New Email from Siimee!'
317 319
         sendSmtpEmail.to = [
318 320
             {
319 321
                 email: userCredentials.email,

Laddar…
Avbryt
Spara