2023-09-14 22:30:20 +12:00
|
|
|
<script>
|
2025-06-20 23:26:06 +12:00
|
|
|
import AjaxLoader from "./AjaxLoader.vue";
|
|
|
|
import Settings from "./AppSettings.vue";
|
|
|
|
import CommonMixins from "../mixins/CommonMixins";
|
|
|
|
import { mailbox } from "../stores/mailbox";
|
2023-09-14 22:30:20 +12:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2024-04-13 00:25:04 +12:00
|
|
|
AjaxLoader,
|
|
|
|
Settings,
|
2023-09-14 22:30:20 +12:00
|
|
|
},
|
|
|
|
|
2025-06-20 23:26:06 +12:00
|
|
|
mixins: [CommonMixins],
|
|
|
|
|
2023-09-22 15:06:03 +12:00
|
|
|
props: {
|
|
|
|
modals: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
2025-06-20 23:26:06 +12:00
|
|
|
},
|
2023-09-22 15:06:03 +12:00
|
|
|
},
|
|
|
|
|
2023-09-14 22:30:20 +12:00
|
|
|
data() {
|
|
|
|
return {
|
2023-09-22 15:06:03 +12:00
|
|
|
mailbox,
|
2025-06-20 23:26:06 +12:00
|
|
|
};
|
2023-09-14 22:30:20 +12:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2024-06-22 13:27:00 +12:00
|
|
|
loadInfo() {
|
2025-06-20 23:26:06 +12:00
|
|
|
this.get(this.resolve("/api/v1/info"), false, (response) => {
|
|
|
|
mailbox.appInfo = response.data;
|
|
|
|
this.modal("AppInfoModal").show();
|
|
|
|
});
|
2023-09-14 22:30:20 +12:00
|
|
|
},
|
|
|
|
|
2024-06-22 13:27:00 +12:00
|
|
|
requestNotifications() {
|
2023-09-22 15:06:03 +12:00
|
|
|
// check if the browser supports notifications
|
|
|
|
if (!("Notification" in window)) {
|
2025-06-20 23:26:06 +12:00
|
|
|
alert("This browser does not support desktop notifications");
|
2023-09-22 15:06:03 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
// we need to ask the user for permission
|
|
|
|
else if (Notification.permission !== "denied") {
|
2024-11-07 16:35:37 +13:00
|
|
|
Notification.requestPermission().then((permission) => {
|
2023-09-22 15:06:03 +12:00
|
|
|
if (permission === "granted") {
|
2025-06-20 23:26:06 +12:00
|
|
|
mailbox.notificationsEnabled = true;
|
2023-09-22 15:06:03 +12:00
|
|
|
}
|
2024-11-07 16:35:37 +13:00
|
|
|
|
2025-06-20 23:26:06 +12:00
|
|
|
this.modal("EnableNotificationsModal").hide();
|
|
|
|
});
|
2023-09-22 15:06:03 +12:00
|
|
|
}
|
|
|
|
},
|
2025-06-20 23:26:06 +12:00
|
|
|
},
|
|
|
|
};
|
2023-09-14 22:30:20 +12:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-09-22 15:06:03 +12:00
|
|
|
<template v-if="!modals">
|
2024-08-04 17:04:14 +12:00
|
|
|
<div class="bg-body ms-sm-n1 me-sm-n1 py-2 text-muted small about-mailpit">
|
2025-06-20 23:26:06 +12:00
|
|
|
<button class="text-muted btn btn-sm" @click="loadInfo()">
|
2023-09-22 15:06:03 +12:00
|
|
|
<i class="bi bi-info-circle-fill me-1"></i>
|
|
|
|
About
|
|
|
|
</button>
|
|
|
|
|
2025-06-20 23:26:06 +12:00
|
|
|
<button
|
|
|
|
class="btn btn-sm btn-outline-secondary float-end"
|
|
|
|
data-bs-toggle="modal"
|
|
|
|
data-bs-target="#SettingsModal"
|
|
|
|
title="Mailpit UI settings"
|
|
|
|
>
|
2024-04-13 00:25:04 +12:00
|
|
|
<i class="bi bi-gear-fill"></i>
|
|
|
|
</button>
|
2023-09-22 15:06:03 +12:00
|
|
|
|
2025-06-20 23:26:06 +12:00
|
|
|
<button
|
|
|
|
v-if="mailbox.connected && mailbox.notificationsSupported && !mailbox.notificationsEnabled"
|
|
|
|
class="btn btn-sm btn-outline-secondary float-end me-2"
|
|
|
|
data-bs-toggle="modal"
|
|
|
|
data-bs-target="#EnableNotificationsModal"
|
|
|
|
title="Enable browser notifications"
|
|
|
|
>
|
2023-09-22 15:06:03 +12:00
|
|
|
<i class="bi bi-bell"></i>
|
2023-09-14 22:30:20 +12:00
|
|
|
</button>
|
|
|
|
</div>
|
2023-09-22 15:06:03 +12:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-else>
|
|
|
|
<!-- Modals -->
|
2025-06-20 23:26:06 +12:00
|
|
|
<div
|
|
|
|
id="AppInfoModal"
|
|
|
|
class="modal modal-xl fade"
|
|
|
|
tabindex="-1"
|
|
|
|
aria-labelledby="AppInfoModalLabel"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2023-09-22 15:06:03 +12:00
|
|
|
<div class="modal-dialog">
|
2025-06-20 23:26:06 +12:00
|
|
|
<div v-if="mailbox.appInfo.RuntimeStats" class="modal-content">
|
2024-01-02 13:23:16 +13:00
|
|
|
<div class="modal-header">
|
2025-06-20 23:26:06 +12:00
|
|
|
<h5 id="AppInfoModalLabel" class="modal-title">
|
2023-09-22 15:06:03 +12:00
|
|
|
Mailpit
|
|
|
|
<code>({{ mailbox.appInfo.Version }})</code>
|
|
|
|
</h5>
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="row g-3">
|
2024-01-02 13:23:16 +13:00
|
|
|
<div class="col-xl-6">
|
2025-06-19 11:29:20 +01:00
|
|
|
<div v-if="mailbox.appInfo.LatestVersion != 'disabled'">
|
2025-06-20 23:26:06 +12:00
|
|
|
<div v-if="mailbox.appInfo.LatestVersion == ''" class="row g-3">
|
2025-06-19 11:29:20 +01:00
|
|
|
<div class="col">
|
|
|
|
<div class="alert alert-warning mb-3">
|
|
|
|
There might be a newer version available. The check failed.
|
|
|
|
</div>
|
2024-07-07 22:17:21 +12:00
|
|
|
</div>
|
2024-02-05 22:55:49 +13:00
|
|
|
</div>
|
2025-06-20 23:26:06 +12:00
|
|
|
<div
|
|
|
|
v-else-if="mailbox.appInfo.Version != mailbox.appInfo.LatestVersion"
|
|
|
|
class="row g-3"
|
|
|
|
>
|
2025-06-19 11:29:20 +01:00
|
|
|
<div class="col">
|
2025-06-20 23:26:06 +12:00
|
|
|
<a
|
|
|
|
class="btn btn-warning d-block mb-3"
|
|
|
|
:href="
|
|
|
|
'https://github.com/axllent/mailpit/releases/tag/' +
|
|
|
|
mailbox.appInfo.LatestVersion
|
|
|
|
"
|
|
|
|
>
|
|
|
|
A new version of Mailpit ({{ mailbox.appInfo.LatestVersion }}) is
|
|
|
|
available.
|
2025-06-19 11:29:20 +01:00
|
|
|
</a>
|
|
|
|
</div>
|
2024-07-07 22:17:21 +12:00
|
|
|
</div>
|
2024-02-05 22:55:49 +13:00
|
|
|
</div>
|
2024-01-02 13:23:16 +13:00
|
|
|
<div class="row g-3">
|
|
|
|
<div class="col-12">
|
|
|
|
<RouterLink to="/api/v1/" class="btn btn-primary w-100" target="_blank">
|
|
|
|
<i class="bi bi-braces"></i>
|
|
|
|
OpenAPI / Swagger API documentation
|
|
|
|
</RouterLink>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
2025-06-20 23:26:06 +12:00
|
|
|
<a
|
|
|
|
class="btn btn-primary w-100"
|
|
|
|
href="https://github.com/axllent/mailpit"
|
|
|
|
target="_blank"
|
|
|
|
>
|
2024-01-02 13:23:16 +13:00
|
|
|
<i class="bi bi-github"></i>
|
|
|
|
Github
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
2025-06-20 23:26:06 +12:00
|
|
|
<a
|
|
|
|
class="btn btn-primary w-100"
|
|
|
|
href="https://mailpit.axllent.org/docs/"
|
|
|
|
target="_blank"
|
|
|
|
>
|
2024-01-02 13:23:16 +13:00
|
|
|
Documentation
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="col-6">
|
|
|
|
<div class="card border-secondary text-center">
|
|
|
|
<div class="card-header">Database size</div>
|
2025-05-18 10:27:59 +12:00
|
|
|
<div class="card-body text-muted">
|
2025-06-20 23:26:06 +12:00
|
|
|
<h5 class="card-title">
|
|
|
|
{{ getFileSize(mailbox.appInfo.DatabaseSize) }}
|
2024-04-13 00:25:04 +12:00
|
|
|
</h5>
|
2024-01-02 13:23:16 +13:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-6">
|
|
|
|
<div class="card border-secondary text-center">
|
|
|
|
<div class="card-header">RAM usage</div>
|
2025-05-18 10:27:59 +12:00
|
|
|
<div class="card-body text-muted">
|
2024-04-13 00:25:04 +12:00
|
|
|
<h5 class="card-title">
|
|
|
|
{{ getFileSize(mailbox.appInfo.RuntimeStats.Memory) }}
|
|
|
|
</h5>
|
2024-01-02 13:23:16 +13:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-22 15:06:03 +12:00
|
|
|
</div>
|
2023-09-14 22:30:20 +12:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-02 13:23:16 +13:00
|
|
|
<div class="col-xl-6">
|
2024-11-16 15:21:45 +13:00
|
|
|
<div class="card border-secondary h-100">
|
2024-01-02 13:23:16 +13:00
|
|
|
<div class="card-header h4">
|
|
|
|
Runtime statistics
|
2025-06-20 23:26:06 +12:00
|
|
|
<button class="btn btn-sm btn-outline-secondary float-end" @click="loadInfo()">
|
2024-01-02 13:23:16 +13:00
|
|
|
Refresh
|
|
|
|
</button>
|
|
|
|
</div>
|
2025-05-18 10:27:59 +12:00
|
|
|
<div class="card-body text-muted">
|
2024-01-02 13:23:16 +13:00
|
|
|
<table class="table table-sm table-borderless mb-0">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2025-06-20 23:26:06 +12:00
|
|
|
<td>Mailpit up since</td>
|
2024-01-02 13:23:16 +13:00
|
|
|
<td>
|
|
|
|
{{ secondsToRelative(mailbox.appInfo.RuntimeStats.Uptime) }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2025-06-20 23:26:06 +12:00
|
|
|
<td>Messages deleted</td>
|
2024-01-02 13:23:16 +13:00
|
|
|
<td>
|
|
|
|
{{ formatNumber(mailbox.appInfo.RuntimeStats.MessagesDeleted) }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2025-06-20 23:26:06 +12:00
|
|
|
<td>SMTP messages accepted</td>
|
2024-01-02 13:23:16 +13:00
|
|
|
<td>
|
2024-01-03 12:06:36 +13:00
|
|
|
{{ formatNumber(mailbox.appInfo.RuntimeStats.SMTPAccepted) }}
|
2025-05-18 10:27:59 +12:00
|
|
|
<small class="text-muted">
|
2024-06-22 13:27:00 +12:00
|
|
|
({{
|
2025-06-20 23:26:06 +12:00
|
|
|
getFileSize(
|
|
|
|
mailbox.appInfo.RuntimeStats.SMTPAcceptedSize,
|
|
|
|
)
|
2024-08-04 17:04:14 +12:00
|
|
|
}})
|
2024-01-03 12:06:36 +13:00
|
|
|
</small>
|
2024-01-02 13:23:16 +13:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2025-06-20 23:26:06 +12:00
|
|
|
<td>SMTP messages rejected</td>
|
2024-01-02 13:23:16 +13:00
|
|
|
<td>
|
2024-01-03 12:06:36 +13:00
|
|
|
{{ formatNumber(mailbox.appInfo.RuntimeStats.SMTPRejected) }}
|
2024-01-02 13:23:16 +13:00
|
|
|
</td>
|
|
|
|
</tr>
|
2024-01-23 16:11:11 +13:00
|
|
|
<tr v-if="mailbox.uiConfig.DuplicatesIgnored">
|
2025-06-20 23:26:06 +12:00
|
|
|
<td>SMTP messages ignored</td>
|
2024-01-02 13:23:16 +13:00
|
|
|
<td>
|
|
|
|
{{ formatNumber(mailbox.appInfo.RuntimeStats.SMTPIgnored) }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2023-09-22 15:06:03 +12:00
|
|
|
</div>
|
2023-09-14 22:30:20 +12:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-22 15:06:03 +12:00
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Close</button>
|
|
|
|
</div>
|
2023-09-14 22:30:20 +12:00
|
|
|
</div>
|
2023-09-22 15:06:03 +12:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2025-06-20 23:26:06 +12:00
|
|
|
<div
|
|
|
|
id="EnableNotificationsModal"
|
|
|
|
class="modal fade"
|
|
|
|
tabindex="-1"
|
|
|
|
aria-labelledby="EnableNotificationsModalLabel"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2023-09-22 15:06:03 +12:00
|
|
|
<div class="modal-dialog modal-lg">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2025-06-20 23:26:06 +12:00
|
|
|
<h5 id="EnableNotificationsModalLabel" class="modal-title">Enable browser notifications?</h5>
|
2023-09-22 15:06:03 +12:00
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<p class="h4">Get browser notifications when Mailpit receives new messages?</p>
|
|
|
|
<p>
|
|
|
|
Note that your browser will ask you for confirmation when you click
|
2025-06-20 23:26:06 +12:00
|
|
|
<code>enable notifications</code>, and that you must have Mailpit open in a browser tab to
|
|
|
|
be able to receive the notifications.
|
2023-09-22 15:06:03 +12:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
2025-06-20 23:26:06 +12:00
|
|
|
<button type="button" class="btn btn-success" @click="requestNotifications">
|
2024-11-07 16:35:37 +13:00
|
|
|
Enable notifications
|
|
|
|
</button>
|
2023-09-22 15:06:03 +12:00
|
|
|
</div>
|
2023-09-14 22:30:20 +12:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2024-04-13 00:25:04 +12:00
|
|
|
<Settings />
|
|
|
|
</template>
|
2024-06-22 13:27:00 +12:00
|
|
|
|
2023-09-14 22:30:20 +12:00
|
|
|
<AjaxLoader :loading="loading" />
|
|
|
|
</template>
|