[IGN-6887] Read E-Mails on IMAP with OAUTH2

I have a customer that is using e-mail to transfer data to Ignition. The script that is being used to retrieve and process those e-mails and attachments is using the python imaplib. Now with MSFT and Google dropping basic authentication, that library doesn't want to connect which is not surprising.

We are working with the customer to move away from this mechanism, but in the event that the other system can't do anything other than e-mail, what options do we have to fill this gap? I started messing with the javax.mail library, but it isn't included with Ignition at this moment and it seems that to include this would require wrapping it in a module which would involve learning that and time that we don't have at the moment.

Is there another library included with Ignition that we can use to read e-mails off an IMAP server using OAUTH2? Or is it pretty much just the javamail implementation that we need to work with?

You would need to work with the javamail implementation, just like our new Oauth2 email profiles do.

OK.

For reference, can we just drop the .jar file in on the gateway and just use it in gateway scoped scripts? For client side we'd have to roll it up into a wrapper correct?

Or with the new Oauth2 implementation, will javamail be included?

javamail has always been included in gateway scope.

If you're able to upgrade to the latest Ignition then you can probably use the new generic OAuth client management that was introduced to support the new email profile.

The hardest part about all of this is the Oauth token management, not using javamail. That barely changes.

OK I wasn't aware that it was included in the gateway scope. That's why I seem lost. :smiley:

Their gateway is sitting at 8.1.22. Does that include the OAuth token stuff or will it be a later version?

Mmm, I think it's in the 8.1.24 nightly right now. So I guess it's not released yet.

OK that's fine. I'll let them know and then we can evaluate when that version is released.

I do hope that they figure out a different method... reading an email inbox is clunky.

Thanks!

Sure is. They probably saw somebody doing this via FTP and said "HOLD MY BEER".

5 Likes

Ok, really did laugh out loud for that.

Yeah.... that's pretty much what they said. The other system is an older ERP system that doesn't play well with anything.

Just a thought, but, you could maybe look at a SMTP to Protocol gateway, such as Mailrise or smtp2http?

Unfortunately Ignition's new OAuth2 APIs are not yet exposed in the public SDK, but since @bschroeder is interested in using it, I'll see if I can prioritize exposing it publicly...

1 Like