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
|
||||
if (server.sendEmail && settings.emailSender && settings.emailRecipient) {
|
||||
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,
|
||||
to: settings.emailRecipient,
|
||||
subject: `[outage] ${service.name} is down`,
|
||||
body: `<p>Dear recipient,</p>
|
||||
<p>This is to inform you about web service outage.
|
||||
The service <em>${service.name}</em> does not meet the
|
||||
requirements for being considered as 'working'.</p>
|
||||
<p>Please always check this before taking action.</p>`,
|
||||
body: `Dear recipient,
|
||||
|
||||
As of ${date} UTC time, the service "${service.name}" does not meet the requirements for being
|
||||
considered as working.
|
||||
|
||||
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) {
|
||||
server.error('could not send endpoint status notification e-mail');
|
||||
|
Loading…
Reference in New Issue
Block a user