mirror of
https://github.com/smartyellow/status.git
synced 2025-01-18 05:27:58 +00:00
Send status e-mail
This commit is contained in:
parent
e973d4dfea
commit
6f32a9eb3b
@ -56,16 +56,26 @@ async function processOutage({ outage, server, settings, onDateUpdated }) {
|
|||||||
// Send e-mail notification
|
// Send e-mail notification
|
||||||
if (server.sendEmail && settings.emailSender && settings.emailRecipient) {
|
if (server.sendEmail && settings.emailSender && settings.emailRecipient) {
|
||||||
try {
|
try {
|
||||||
server.sendEmail({
|
const date = new Date().toLocaleString('en-GB', {
|
||||||
|
dateStyle: 'full',
|
||||||
|
timeStyle: 'full',
|
||||||
|
timeZone: 'Etc/UTC',
|
||||||
|
});
|
||||||
|
const a = await server.sendEmail({
|
||||||
sender: settings.emailSender,
|
sender: settings.emailSender,
|
||||||
to: settings.emailRecipient,
|
to: settings.emailRecipient,
|
||||||
subject: `[outage] ${service.name} is down`,
|
subject: `[outage] ${service.name} is down`,
|
||||||
body: `<p>Dear recipient,</p>
|
body: `Dear recipient,
|
||||||
<p>This is to inform you about web service outage.
|
|
||||||
The service <em>${service.name}</em> does not meet the
|
As of ${date} UTC time, the service "${service.name}" does not meet the requirements for being
|
||||||
requirements for being considered as 'working'.</p>
|
considered as working.
|
||||||
<p>Please always check this before taking action.</p>`,
|
|
||||||
|
Technical information containing the reason for this alert:
|
||||||
|
${JSON.stringify(testResult, null, 2)}
|
||||||
|
|
||||||
|
Please always check this before taking action. This is an automated message.`,
|
||||||
});
|
});
|
||||||
|
console.log(a);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
server.error('could not send endpoint status notification e-mail');
|
server.error('could not send endpoint status notification e-mail');
|
||||||
|
Loading…
Reference in New Issue
Block a user