Reputation: 13
We are experiencing an issue in a Node.js application where we are using IMAPflow (version 162) to fetch emails from a Gmail account configured with an app password. The problem is that the email fetching is inconsistent: we seem to only retrieve every other email. For instance, we might receive the 1st, 3rd, and 5th emails, and miss the 2nd, 4th, etc. At other times, this pattern reverses, and we miss the 1st, 3rd, etc., while receiving the 2nd, 4th, and so on.
Here is a simplified version of the code:
const { ImapFlow } = require('imapflow');
const client = new ImapFlow({
host: 'imap.gmail.com',
port: 993,
secure: true,
auth: {
user: '[email protected]',
pass: 'your-app-password'
}
});
async function fetchEmails() {
await client.connect();
let lock = await client.getMailboxLock('INBOX');
try {
for await (const message of client.fetch('1:*', { envelope: true })) {
console.log(message.envelope);
}
} finally {
lock.release();
}
await client.logout();
}
fetchEmails();
Has anyone encountered a similar issue? Could there be an issue from the provider which is Gmail here?
Any insights or suggestions that can help us is greatly appreciated!
Upvotes: 1
Views: 212