I'm using nodejs
with the library imap
, and I'm trying to only get the last email but i don't know the parameter exact to filter. Does anyone know? Thank you!
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: '' });
CodePudding user response:
Looking at the documentation, it doesn't look like you can. But you can use RECENT
instead of ALL
and then in the callback just get the first item in the array