From 30b11f465c8764ea66af0667d75d274c0d14d302 Mon Sep 17 00:00:00 2001 From: Veeshavan <125199213+Veeshavanachu@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:56:14 +0530 Subject: [PATCH] Updated mailgun-js to mailgun.js --- server/services/mailgun.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/services/mailgun.js b/server/services/mailgun.js index 3034a82c..f6033b75 100644 --- a/server/services/mailgun.js +++ b/server/services/mailgun.js @@ -1,4 +1,4 @@ -const Mailgun = require('mailgun-js'); +const Mailgun = require('mailgun.js'); // Updated from 'mailgun-js' to 'mailgun.js' const template = require('../config/template'); const keys = require('../config/keys'); @@ -8,7 +8,8 @@ const { key, domain, sender } = keys.mailgun; class MailgunService { init() { try { - return new Mailgun({ + const mailgun = new Mailgun(); + return mailgun.client({ apiKey: key, domain: domain }); @@ -31,7 +32,7 @@ exports.sendEmail = async (email, type, host, data) => { text: message.text }; - return await mailgun.messages().send(config); + return await mailgun.messages.create(domain, config); // Updated to use mailgun.js syntax } catch (error) { return error; }