Advertisement
Vincent38190

Untitled

Jun 6th, 2021
2,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let defaultClient = SibApiV3Sdk.ApiClient.instance
  2.         let apiKey = defaultClient.authentications['api-key']
  3.         apiKey.apiKey = process.env.CLEF_API;
  4.  
  5.         let apiInstance = new SibApiV3Sdk.TransactionalEmailsApi();
  6.         let sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail();
  7.  
  8.         sendSmtpEmail.subject = "New password"
  9.         sendSmtpEmail.htmlContent = "Hello " + data.prenom + "\nYour new password is : " + new_password + "\n\nBest regards"
  10.         sendSmtpEmail.sender = "szkglsk@gmail.com"
  11.         sendSmtpEmail.to = req.body.email;
  12.  
  13.         await apiInstance.sendTransacEmail(sendSmtpEmail).then(
  14.             function (data) {
  15.               console.log('API called successfully. Returned data: ' + JSON.stringify(data))
  16.               return JSON.stringify(data)
  17.             },
  18.             function (error) {
  19.               console.error(error)
  20.               throw error
  21.             }
  22.           )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement