Monday 25 February 2019

[Question] How to fetch emails with their markup with Oauth2 (Gmail and Outlook)

Currently coding an app with Electron + React: The aim is to allow the user to fetch his latest emails from whatever service (in this case either Gmail or Outlook). These mails need to be fetched with their HTML markup and attachments. The user then decides if he wants to "archive" them, after which another unrelated process takes place​So far I'm having a lot of trouble wrapping my head around Oauth2: What I've gathered so far is that using node-imap requires me to set the account to use "less secure apps" but from what I've read that is less than ideal. Not to mention it'd require the user to fiddle in their settings instead of just clicking "allow".Is there any "simple" way to set up Oauth2 in an Electron + React stack to fetch emails through node-imap? Tutorials I've found so far go to great tangents and always lose me somewhere along the way.​As for fetching the emails themselves, node-imap allows to fetch plain text but not the HTML markup. After a thorough search through their issues the owner mentions and even shows an example, that sadly doesn't work.​tl;drWhat is the simplest way to set up Oauth2 (on Gmail and Outlook) to be able to fetch emails and their attachmentsFollow-up question: In the case of Google, am I required to add credit card information per the recent changes in their API? I'm asking because this might pose legal problems in this specific case in my countryUsing node-imap (or a similar lib) how can I fetch emails as HTML markup, with their styles? (to be able to display them as they appear in the Inbox)​PS: I also fiddled around with Mailkit, and I've managed to get emails with their HTML and styling. If I can't make node-imap work for me I'm considering using it thanks to Edge.jsBut that still leaves the Oauth2 issue.​PSS: The HTML markup is not a hard constraint in this case, but would be greatly valued.​Any and all thoughts are welcome.Thank you

Submitted February 25, 2019 at 02:40PM by Unforgiven-wanda

No comments:

Post a Comment