Javascript and mailbox


I receive by email, every 5 minutes, an email giving me GPS coordinates. This email is a set of preformatted characters and therefore no problem to use it in javascript.
But how to get this email in my mailbox.
I just need, not the code, but rather the procedure to read this email
Thank you for your help.

I think you can use some npm lib like this:

This can be a rabbit hole.
GitHub - mscdex/node-imap: An IMAP client module for node.js. will allow you to access your mailbox. Decoding messages is another game Mailparser :: Nodemailer
Do you have a choice on how you get the data? Can you set up a webhook to receive it? That is much less complex, as you won’t need to scan your mailbox and parse incoming messages, you just get clean JSON data.

I’m making no assumptions about your mail provider. I will assume, however, you have a way to get the raw email file. If so, the MailParser npm package might work for you:

The documentation is pretty clear. A strategy would be to look up the content type property and extract the body data from the related object using the easier parsing method.

I noticed @mikkelking suggested the same package for reading data from the mail.