Open ChrisThePCGeek opened 1 year ago
so you basically want a email-sent and receive loop and have a notification if no mail show up in interval x, right?
Yeah that's the idea I had, I think it would work to verify an email server was up and working. could even trigger a fail if the send doesn't work since sometimes send works but receive doesn't.
Something similar to these options would also be great, if email send is a heavy option. https://www.wormly.com/test-smtp-server
530 Authentication required
it should be considered OK@ChrisThePCGeek Interested to develop together a new monitor for mail server's?
I love to have this feature, at least to test if the e-mail works and on the other end if the mail is received... I love to follow up this capability, I not a programmer on node maybe create some doc about how to install with a no-root user, and Patrion the project. :-P
@ediazrod @erseco Issues are for discussing what needs to be done how by whom. We use 👍🏻 on issues to prioritise work, as always: Pull Requests welcome.
I think the sending and receiving actual Mail might be quite complex.
I would already be fine with something more simple. A check, that
Something like:
const { SMTPClient } = require('smtp-client');
module.exports = function(smtpConfig) {
return {
async check() {
const client = new SMTPClient({
host: smtpConfig.host,
port: smtpConfig.port,
secure: false,
useSecureTransport: false,
ignoreTLS: true,
requireTLS: false,
timeout: 5000,
});
try {
await client.connect();
const response = await client.sendCommand('EHLO localhost');
if (response.code !== 250) {
throw new Error('EHLO command failed');
}
const starttlsResponse = await client.sendCommand('STARTTLS');
if (starttlsResponse.code !== 220) {
throw new Error('STARTTLS command failed');
}
await client.secure({
rejectUnauthorized: smtpConfig.rejectUnauthorized,
});
const mailFromResponse = await client.sendCommand(`MAIL FROM:<${smtpConfig.from}>`);
if (mailFromResponse.code !== 250) {
throw new Error('MAIL FROM command failed');
}
const rcptToResponse = await client.sendCommand(`RCPT TO:<${smtpConfig.to}>`);
if (rcptToResponse.code !== 250) {
throw new Error('RCPT TO command failed');
}
return true; // SMTP server is reachable
} catch (error) {
throw new Error(`SMTP server check failed: ${error.message}`);
} finally {
client.close();
}
},
};
};
Whats missing there is the ability to make StartTLS optional and to actually validate the Certificate.
Note that our contribution guide is here https://github.com/louislam/uptime-kuma/blob/1550a5f79270f39007086d8d23c180ba9f63096b/CONTRIBUTING.md ^^
I think it would be enough to be able to connect and receive an initial positive status (i. e. the full roundtrip should be optional to configure).
I am willing to sponsor implementation of this feature. If someone is interested in doing this please let me know.
⚠️ Please verify that this feature request has NOT been suggested before.
🏷️ Feature Request Type
New Monitor
🔖 Feature description
✔️ Solution
noted in description
❓ Alternatives
No response
📝 Additional Context
No response