Procházet zdrojové kódy

:recycle: try different Brevo usage

dev
j před 2 roky
rodič
revize
ff45f381d7
1 změnil soubory, kde provedl 11 přidání a 9 odebrání
  1. 11
    9
      backend/lib/services/user.js

+ 11
- 9
backend/lib/services/user.js Zobrazit soubor

7
 const SecurePassword = require('secure-password')
7
 const SecurePassword = require('secure-password')
8
 
8
 
9
 // Configuration for Brevo
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
 // TODO: Consider implementing, nice use of SecurePassword,
18
 // TODO: Consider implementing, nice use of SecurePassword,
17
 // but currently not used anywhere...
19
 // but currently not used anywhere...
306
             emailWasRespondedTo: false,
308
             emailWasRespondedTo: false,
307
             accessToken: null,
309
             accessToken: null,
308
         }
310
         }
309
-        // NOTE: Although this looks messy, Brevo requries these
311
+        // NOTE: Although this looks messy, Brevo requires these
310
         // parameters be defined individually like this, attempts
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
         sendSmtpEmail.sender = {
314
         sendSmtpEmail.sender = {
313
-            name: 'My Test Company',
315
+            name: '[siimee]',
314
             email: 'mytestemail@email.com',
316
             email: 'mytestemail@email.com',
315
         }
317
         }
316
-        sendSmtpEmail.subject = 'My Test Company'
318
+        sendSmtpEmail.subject = '[siimee] New Email from Siimee!'
317
         sendSmtpEmail.to = [
319
         sendSmtpEmail.to = [
318
             {
320
             {
319
                 email: userCredentials.email,
321
                 email: userCredentials.email,

Načítá se…
Zrušit
Uložit