Add fingerprint API key In (load & create profile) action Maxxx give you an example with screenshot
If you don't want load fingerprint then set as false fingerprint setting
Не запускается код через встроенный код, тестил как 18 и 12 NodeJS, за секунду просто быстро проходит действие и ничего в лог
Через replit все запускается и работает
код:
const dns = require('dns');
const net = require('net');
function checkImapServer(domain) {
return new Promise((resolve, reject) => {
dns.resolveMx(domain, (err, addresses) => {
if (err || addresses.length === 0) {
console.log("Не удалось найти IMAP-сервер по домену.");
reject(new Error("Не удалось найти IMAP-сервер по домену."));
return;
}
const mxRecord = addresses[0].exchange;
const imapServer = mxRecord.startsWith(domain)
? `imap.${domain}`
: mxRecord.replace(/\.$/, '').replace(/mail\./, 'imap.');
console.log(`Найден возможный IMAP-сервер: ${imapServer}`);
resolve(imapServer);
});
});
}
function testImapServer(imapUrl) {
return new Promise((resolve, reject) => {
const socket = net.createConnection(
{ host: imapUrl, port: 993, timeout: 10000 },
() => {
console.log(`Сервер ${imapUrl} доступен.`);
socket.end();
resolve(true);
}
);
socket.on('error', (err) => {
console.log(`Сервер ${imapUrl} недоступен.`);
reject(new Error(`Сервер ${imapUrl} недоступен.`));
});
socket.on('timeout', () => {
socket.destroy();
console.log(`Сервер ${imapUrl} недоступен.`);
reject(new Error('Connection timed out'));
});
});
}
async function findImapServer(emailAddress) {
const domain = emailAddress.split('@')[1];
try {
const imapUrl = await checkImapServer(domain);
await testImapServer(imapUrl);
return imapUrl; // Возвращаем IMAP-сервер, если он найден и доступен
} catch (err) {
console.error(err.message);
return null; // Возвращаем null в случае ошибки
}
}
// Пример использования:
(async () => {
const mail = "ytvxlghvk809407045@chinaxqm.com";
const imapServer = await findImapServer(mail);
if (imapServer) {
console.log(`Найден рабочий IMAP-сервер: ${imapServer}`);
} else {
console.log("Не удалось найти рабочий IMAP-сервер.");
}
})();