mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-08-07 09:14:58 +00:00
feat: add TurboSMTP email notification provider (#7640)
This commit is contained in:
@@ -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;
|
||||
@@ -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(),
|
||||
|
||||
@@ -289,6 +289,7 @@ export default {
|
||||
Resend: "Resend",
|
||||
SendGrid: "SendGrid",
|
||||
smtp: this.$t("smtp"),
|
||||
TurboSMTP: "TurboSMTP",
|
||||
};
|
||||
|
||||
// Incident Management - On-call and alerting platforms
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-consumer-key" class="form-label">{{ $t("turbosmtpConsumerKey") }}</label>
|
||||
<HiddenInput
|
||||
id="turbosmtp-consumer-key"
|
||||
v-model="$parent.notification.turbosmtpConsumerKey"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
></HiddenInput>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-consumer-secret" class="form-label">{{ $t("turbosmtpConsumerSecret") }}</label>
|
||||
<HiddenInput
|
||||
id="turbosmtp-consumer-secret"
|
||||
v-model="$parent.notification.turbosmtpConsumerSecret"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
></HiddenInput>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-region" class="form-label">{{ $t("Region") }}</label>
|
||||
<select
|
||||
id="turbosmtp-region"
|
||||
v-model="$parent.notification.turbosmtpRegion"
|
||||
:required="true"
|
||||
class="form-select"
|
||||
>
|
||||
<option value="us">US (Default)</option>
|
||||
<option value="eu">EU</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-from-email" class="form-label">{{ $t("From Email") }}</label>
|
||||
<input
|
||||
id="turbosmtp-from-email"
|
||||
v-model="$parent.notification.turbosmtpFromEmail"
|
||||
type="text"
|
||||
class="form-control"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-to-email" class="form-label">{{ $t("To Email") }}</label>
|
||||
<input
|
||||
id="turbosmtp-to-email"
|
||||
v-model="$parent.notification.turbosmtpToEmail"
|
||||
type="text"
|
||||
class="form-control"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-cc-email" class="form-label">{{ $t("smtpCC") }}</label>
|
||||
<input
|
||||
id="turbosmtp-cc-email"
|
||||
v-model="$parent.notification.turbosmtpCcEmail"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label>
|
||||
<input
|
||||
id="turbosmtp-bcc-email"
|
||||
v-model="$parent.notification.turbosmtpBccEmail"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="turbosmtp-subject" class="form-label">{{ $t("Subject:") }}</label>
|
||||
<input
|
||||
id="turbosmtp-subject"
|
||||
v-model="$parent.notification.turbosmtpSubject"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
<small class="form-text text-muted">{{ $t("leave blank for default subject") }}</small>
|
||||
</div>
|
||||
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px">
|
||||
<a href="https://serversmtp.com/turbo-api/" target="_blank">https://serversmtp.com/turbo-api/</a>
|
||||
</i18n-t>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
},
|
||||
mounted() {
|
||||
if (typeof this.$parent.notification.turbosmtpRegion === "undefined") {
|
||||
this.$parent.notification.turbosmtpRegion = "us";
|
||||
}
|
||||
if (typeof this.$parent.notification.turbosmtpSubject === "undefined") {
|
||||
this.$parent.notification.turbosmtpSubject = "Notification from Your Uptime Kuma";
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -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,
|
||||
|
||||
@@ -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}",
|
||||
|
||||
Reference in New Issue
Block a user