super-imap icon indicating copy to clipboard operation
super-imap copied to clipboard

any ETA on a plain connection type?

Open blysik opened this issue 8 years ago • 6 comments

I see raise :todo, when I attempt to connect a user to a plain type.

blysik avatar Sep 14 '15 17:09 blysik

@rustyio same here, can this project not be used unless it is with OAuth?

kshahkshah avatar Mar 08 '16 16:03 kshahkshah

@whistlerbrk @blysik Unfortunately, it's unlikely that I'll make any changes or improvements to this project. I've left the company using this code, and have moved on to another venture. It's best to consider the existing codebase stable but -- as of now -- unmaintained.

If either of you (or anybody else) is interested in making and testing the changes to finish the plain connection type, I'd be happy to point you in the right direction.

rustyio avatar Mar 09 '16 18:03 rustyio

@rustyio that is indeed a possibility. I'm contracting with a company right now that has a use case and this seems like the most solid base I've found yet. I've opened up the code and found the stubs you left.

I'd like to get the go-ahead on this from the powers that be, but I suppose that'll be dependent on how much effort I should expect this to be? As in days, weeks, or months? Sorry to ask, I'm going dive back into the code now and see if I can determine for myself, but I've never been too great at estimates anyway.. like most engineers sigh

kshahkshah avatar Mar 10 '16 19:03 kshahkshah

@whistlerbrk I'd estimate weeks, but it depends on your familiarity with Ruby, your exact approach to implementing the feature, how thoroughly you need to test, and how many providers you plan to support out of the box.

A rough plan is below, with estimates of effort:

Setup / Learn the Code (7 days)

  1. Read the README.
  2. Get a local instance up and running.
  3. Get the local instance connected to an IMAP account. (See README)
  4. Get the local instance connected to an endpoint for email callbacks. (See README)
  5. Gain a high-level familiarity with the code.

Manually set up a Plain-Auth Provider User (1 day)

  1. Create an entry in ImapProviders. You will need the IMAP host, port, and SSL setting. This is a good reference: https://support.mozilla.org/en-US/kb/isp-configuration-settings
  2. Manually create a user under the provider.

Modify app/processes/imap_client/user_thread.rb (2 days)

  1. In #choose_folder, the list of best folders is hard-coded for Gmail. This should be moved to a setting in the ImapProvider table.

Add IMAP Providers (2 days per provider)

There are many different IMAP providers with different IMAP settings. You will need to create a separate entry in the ImapProvider table for each one you would like to support, create a user, and test thoroughly. Note that these IMAP providers must support IMAP idle, otherwise SuperIMAP won't work as currently implemented.

  1. Create a new user at the desired IMAP provider.
  2. Create an ImapProvider entry in your SuperIMAP instance.
  3. Connect SuperIMAP to the IMAP provider.
  4. Send yourself some test emails, make sure SuperIMAP sees them.

Modify app/helpers/plain/connects_helper.rb (5 days)

  1. Change #plain_new_helper to emit a form prompting for an IMAP username and password.
  2. Change #plain_callback_helper to save the login_username and login_password and fire the CallUserConnectedWebhook event. (See the OAuth2 connects_helper.rb for reference.)

This could take longer or shorter depending on how crazy you would like to get with client-side validation, server-side validation, CSS styling, etc.

Modify app/helpers/plain/disconnects_helper.rb (1 day)

  1. Change #plain_new_helper to set the user's login_username and login_password to nil and fire the CallUserDisconnectedWebhook event. (See the OAuth2 disconnects_helper.rb for reference.)

Modify models/plain/imap_provider.rb (5 minutes)

  1. Delete accidental call to client.login in #authenticate_smtp.

Unknowns (0 to 15 days?)

  • The most complex logic is in app/processes/imap_client/user_thread.rb and .../process_uid.rb. This logic has been thoroughly tested with Gmail, but not other IMAP providers. You may run into unexpected quirks depending on how they've implemented IMAP, especially around the UIDVALIDITY process, searching for UIDs, etc.
  • You may need to add fields to the ImapProvider model. Specifically, I believe some IMAP providers require a server username and/or password that is different from the user's username.

Testing (5 days)

  • Add tests for connects_helper.rb and disconnects_helper.rb.

File a SuperIMAP Pull Request (1 day)

  • Please consider documenting your code and contributing back to the main project! This is an MIT-licensed project, so you have no legal obligation, but it would be very nice.
  • If you get this far, ping me and I can probably connect you with another client.

rustyio avatar Mar 15 '16 01:03 rustyio

Wow @rustyio I really appreciate the breakdown. Going to forward the info and see if we can tackle this in the near future. It might be something we do in a few months / later this year; likely not immediately (demo coming up). Either way, great documentation for anyone reading who wants to dive in as well.

kshahkshah avatar Mar 15 '16 19:03 kshahkshah

Sounds good. :+1:

rustyio avatar Mar 16 '16 12:03 rustyio