Closed patryk-matis closed 3 years ago
How did you do it? I have the same problem. The docs say to put onmail to the config for connect, but it is only triggering once and not if i get a new mail.
Nevermind i found an example and my mistake. I changed the current mailbox and didn't get the events.
@Leetcore Maybe you could share a link to the example that helped with your solution?
I do this with:
// new mail event
connection.on('mail', num => {
// new mail in inbox or sent folder
updateMailView(mailConnection, conversations, contacts)
})
My problem was that i changed the current Inbox: connection.openBox('Sent')
. The mail
event will only work for the current Mailbox you have opened. I opened Inbox
first and got the "new mail event" but afters switching to Sent
folder i would not get new emails anymore. That's because the "new mail event" will only trigger for new mails in your currently opened box. I will try to change my code to use two connections for Inbox
and Sent
.
I'm trying to pass connection to onupdate/onmail handler, but I can't figure out how to do it.
I want to use search function each time when new emails arrives. It works fine when I will use my function like: