diff --git a/helpers/templates/emailAlertStatus.js b/helpers/templates/emailAlertStatus.js
new file mode 100644
index 0000000..f81f7f2
--- /dev/null
+++ b/helpers/templates/emailAlertStatus.js
@@ -0,0 +1,164 @@
+export default function emailTest(mailTo, username, aliasList) {
+ const aliasTemplate = (x) => {
+ let str = '';
+ for (const alias of x) {
+ str = str + '
' + alias + '';
+ }
+ return str;
+ };
+
+ const template = {
+ from: 'BorgWarehouse' + '<' + process.env.MAIL_SMTP_FROM + '>',
+ to: mailTo,
+ subject: 'Down status alert !',
+ text: 'Corps de test',
+ html:
+ `
+
+
+
+
+
+ BorgWarehouse
+
+
+
+
+
Some repositories need attention,
` +
+ username +
+ ` !
+
+
+
+
+ List of repositories in down status :
+
+
` +
+ aliasTemplate(aliasList) +
+ `
+
+
+
+
+
+ 🚩
+
+
+ Please remember that the status is based on
+
the last modification. Backups are
+
encrypted from end to end between your client and the
+ server
+ controlled by BorgWarehouse. Don't forget to
+
check the integrity of your backups regularly.
+
+
+
+
+
+`,
+ };
+ return template;
+}
diff --git a/pages/api/cronjob/checkStatus.js b/pages/api/cronjob/checkStatus.js
index 89ca2cb..961315f 100644
--- a/pages/api/cronjob/checkStatus.js
+++ b/pages/api/cronjob/checkStatus.js
@@ -7,7 +7,7 @@ import path from 'path';
const util = require('node:util');
const exec = util.promisify(require('node:child_process').exec);
import nodemailerSMTP from '../../../helpers/functions/nodemailerSMTP';
-import emailTest from '../../../helpers/templates/emailTest';
+import emailAlertStatus from '../../../helpers/templates/emailAlertStatus';
export default async function handler(req, res) {
if (req.headers.authorization == null) {
@@ -150,9 +150,10 @@ export default async function handler(req, res) {
//Create the SMTP Transporter
const transporter = nodemailerSMTP();
//Mail options
- const mailData = emailTest(
+ const mailData = emailAlertStatus(
usersList[0].email,
- usersList[0].username
+ usersList[0].username,
+ repoListToSendAlert
);
transporter.sendMail(mailData, function (err, info) {
if (err) {