mail: use port25check.cloudron.io to check outbound port 25 connectivity

This commit is contained in:
Girish Ramakrishnan
2022-01-31 16:55:45 -08:00
parent c4bcbb8074
commit 37c8ca7617
3 changed files with 8 additions and 10 deletions

View File

@@ -169,11 +169,6 @@ function validateName(name) {
}
async function checkOutboundPort25() {
const smtpServer = _.sample([
'smtp.gmail.com',
'smtp.1und1.de',
]);
const relay = {
value: 'OK',
status: false,
@@ -183,7 +178,7 @@ async function checkOutboundPort25() {
return await new Promise((resolve) => {
const client = new net.Socket();
client.setTimeout(5000);
client.connect(25, smtpServer);
client.connect(25, constants.PORT25_CHECK_SERVER);
client.on('connect', function () {
relay.status = true;
relay.value = 'OK';
@@ -192,16 +187,16 @@ async function checkOutboundPort25() {
});
client.on('timeout', function () {
relay.status = false;
relay.value = `Connect to ${smtpServer} timed out. Check if port 25 (outbound) is blocked`;
relay.value = `Connect to ${constants.PORT25_CHECK_SERVER} timed out. Check if port 25 (outbound) is blocked`;
client.destroy();
relay.errorMessage = `Connect to ${smtpServer} timed out.`;
relay.errorMessage = `Connect to ${constants.PORT25_CHECK_SERVER} timed out.`;
resolve(relay);
});
client.on('error', function (error) {
relay.status = false;
relay.value = `Connect to ${smtpServer} failed: ${error.message}. Check if port 25 (outbound) is blocked`;
relay.value = `Connect to ${constants.PORT25_CHECK_SERVER} failed: ${error.message}. Check if port 25 (outbound) is blocked`;
client.destroy();
relay.errorMessage = `Connect to ${smtpServer} failed.`;
relay.errorMessage = `Connect to ${constants.PORT25_CHECK_SERVER} failed.`;
resolve(relay);
});
});