I'm trying to read messages from inbox by subject, but if i search with a string like this: "Pedido de adição de danos à viatura sfaf", it does not work.
const inbox = require('inbox');
const imap = inbox.createConnection(emailConfig.imapPort, emailConfig.imapHost, { secureConnection: true, auth: emailConfig.auth })
.
.
.
return new Promise<number[]>((resolve, reject) => {
imap.search({ unseen: true, header: ["subject", subject] }, true, (err: any, uids: number[]) => {
if (err) return reject(err);
resolve(uids);
})
});
When i run with that subject i get this error: "Error searching messages"
I'm reading from a Gmail account. Thanks in advance.
[EDIT: I do the connect and openMailBox before]