如何限制要搜索的电子邮件数量?

How can I limit the number of emails I want to search?

我将 nodejs 与库 imap 一起使用,我试图只获取最后一封电子邮件,但我不知道要过滤的确切参数。有人知道吗?谢谢!

const imap = new Imap(imapConfig);
            imap.once('ready', () => {
                imap.openBox('INBOX', false, () => {
                    imap.search(['ALL', ['SINCE', new Date()]], (err, results) => {
                        const f = imap.fetch(results, { bodies: '' });

看文档,好像不行。但是您可以使用 RECENT 而不是 ALL 然后在回调中只获取数组中的第一项