diff --git a/server/notification-providers/turbosmtp.js b/server/notification-providers/turbosmtp.js new file mode 100644 index 000000000..22a4f7d4f --- /dev/null +++ b/server/notification-providers/turbosmtp.js @@ -0,0 +1,55 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); + +class TurboSMTP extends NotificationProvider { + name = "TurboSMTP"; + + /** + * @inheritdoc + */ + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + + try { + let config = { + headers: { + "Content-Type": "application/json", + consumerKey: notification.turbosmtpConsumerKey, + consumerSecret: notification.turbosmtpConsumerSecret, + }, + }; + config = this.getAxiosConfigWithProxy(config); + + const host = notification.turbosmtpRegion === "eu" ? "api.eu.turbo-smtp.com" : "api.turbo-smtp.com"; + + let data = { + from: notification.turbosmtpFromEmail.trim(), + to: notification.turbosmtpToEmail, + subject: notification.turbosmtpSubject || "Notification from Your Uptime Kuma", + content: msg, + }; + + // Comma-separated lists, same format as "to" + if (notification.turbosmtpCcEmail) { + data.cc = notification.turbosmtpCcEmail + .split(",") + .map((email) => email.trim()) + .join(","); + } + + if (notification.turbosmtpBccEmail) { + data.bcc = notification.turbosmtpBccEmail + .split(",") + .map((email) => email.trim()) + .join(","); + } + + await axios.post(`https://${host}/api/v2/mail/send`, data, config); + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } +} + +module.exports = TurboSMTP; diff --git a/server/notification.js b/server/notification.js index 80c8a0ffa..6c35ee1b9 100644 --- a/server/notification.js +++ b/server/notification.js @@ -88,6 +88,7 @@ const Onesender = require("./notification-providers/onesender"); const Wpush = require("./notification-providers/wpush"); const WxPusher = require("./notification-providers/wxpusher"); const SendGrid = require("./notification-providers/send-grid"); +const TurboSMTP = require("./notification-providers/turbosmtp"); const Brevo = require("./notification-providers/brevo"); const Resend = require("./notification-providers/resend"); const YZJ = require("./notification-providers/yzj"); @@ -211,6 +212,7 @@ class Notification { new Notifery(), new SMSIR(), new SendGrid(), + new TurboSMTP(), new Whatsapp360messenger(), new Webpush(), new HaloPSA(), diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 7b6caa1b6..cd996ca13 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -289,6 +289,7 @@ export default { Resend: "Resend", SendGrid: "SendGrid", smtp: this.$t("smtp"), + TurboSMTP: "TurboSMTP", }; // Incident Management - On-call and alerting platforms diff --git a/src/components/notifications/TurboSMTP.vue b/src/components/notifications/TurboSMTP.vue new file mode 100644 index 000000000..fc0819c6c --- /dev/null +++ b/src/components/notifications/TurboSMTP.vue @@ -0,0 +1,104 @@ + + + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 7ef39764b..e301261c8 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -88,6 +88,7 @@ import WPush from "./WPush.vue"; import WxPusher from "./WxPusher.vue"; import SIGNL4 from "./SIGNL4.vue"; import SendGrid from "./SendGrid.vue"; +import TurboSMTP from "./TurboSMTP.vue"; import Brevo from "./Brevo.vue"; import YZJ from "./YZJ.vue"; import SMSPlanet from "./SMSPlanet.vue"; @@ -195,6 +196,7 @@ const NotificationFormList = { WPush: WPush, WxPusher: WxPusher, SendGrid: SendGrid, + TurboSMTP: TurboSMTP, Brevo: Brevo, Resend: Resend, YZJ: YZJ, diff --git a/src/lang/en.json b/src/lang/en.json index ccafea037..8814e60ed 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1336,6 +1336,8 @@ "RabbitMQ Password": "RabbitMQ Password", "rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.", "SendGrid API Key": "SendGrid API Key", + "turbosmtpConsumerKey": "Consumer Key", + "turbosmtpConsumerSecret": "Consumer Secret", "Separate multiple email addresses with commas": "Separate multiple email addresses with commas", "brevoApiKey": "Brevo API Key", "brevoApiHelp": "Create an API key here: {0}",