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
+1
View File
@@ -2416,4 +2416,5 @@
* Add support for secondary domains * Add support for secondary domains
* postgresql: enable postgis * postgresql: enable postgis
* remove nginx config of stopped apps * remove nginx config of stopped apps
* mail: use port25check.cloudron.io to check outbound port 25 connectivity
+2
View File
@@ -61,6 +61,8 @@ exports = module.exports = {
CLOUDRON: CLOUDRON, CLOUDRON: CLOUDRON,
TEST: TEST, TEST: TEST,
PORT25_CHECK_SERVER: 'port25check.cloudron.io',
SUPPORT_EMAIL: 'support@cloudron.io', SUPPORT_EMAIL: 'support@cloudron.io',
USER_DIRECTORY_LDAP_DN: 'cn=admin,ou=system,dc=cloudron', USER_DIRECTORY_LDAP_DN: 'cn=admin,ou=system,dc=cloudron',
+5 -10
View File
@@ -169,11 +169,6 @@ function validateName(name) {
} }
async function checkOutboundPort25() { async function checkOutboundPort25() {
const smtpServer = _.sample([
'smtp.gmail.com',
'smtp.1und1.de',
]);
const relay = { const relay = {
value: 'OK', value: 'OK',
status: false, status: false,
@@ -183,7 +178,7 @@ async function checkOutboundPort25() {
return await new Promise((resolve) => { return await new Promise((resolve) => {
const client = new net.Socket(); const client = new net.Socket();
client.setTimeout(5000); client.setTimeout(5000);
client.connect(25, smtpServer); client.connect(25, constants.PORT25_CHECK_SERVER);
client.on('connect', function () { client.on('connect', function () {
relay.status = true; relay.status = true;
relay.value = 'OK'; relay.value = 'OK';
@@ -192,16 +187,16 @@ async function checkOutboundPort25() {
}); });
client.on('timeout', function () { client.on('timeout', function () {
relay.status = false; 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(); client.destroy();
relay.errorMessage = `Connect to ${smtpServer} timed out.`; relay.errorMessage = `Connect to ${constants.PORT25_CHECK_SERVER} timed out.`;
resolve(relay); resolve(relay);
}); });
client.on('error', function (error) { client.on('error', function (error) {
relay.status = false; 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(); client.destroy();
relay.errorMessage = `Connect to ${smtpServer} failed.`; relay.errorMessage = `Connect to ${constants.PORT25_CHECK_SERVER} failed.`;
resolve(relay); resolve(relay);
}); });
}); });