super-imap
super-imap copied to clipboard
any ETA on a plain connection type?
I see raise :todo, when I attempt to connect a user to a plain type.
@rustyio same here, can this project not be used unless it is with OAuth?
@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 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
@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)
- Read the README.
- Get a local instance up and running.
- Get the local instance connected to an IMAP account. (See README)
- Get the local instance connected to an endpoint for email callbacks. (See README)
- Gain a high-level familiarity with the code.
Manually set up a Plain-Auth Provider User (1 day)
- 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
- Manually create a user under the provider.
Modify app/processes/imap_client/user_thread.rb
(2 days)
- 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.
- Create a new user at the desired IMAP provider.
- Create an ImapProvider entry in your SuperIMAP instance.
- Connect SuperIMAP to the IMAP provider.
- Send yourself some test emails, make sure SuperIMAP sees them.
Modify app/helpers/plain/connects_helper.rb
(5 days)
- Change
#plain_new_helper
to emit a form prompting for an IMAP username and password. - Change
#plain_callback_helper
to save thelogin_username
andlogin_password
and fire theCallUserConnectedWebhook
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)
- Change
#plain_new_helper
to set the user'slogin_username
andlogin_password
to nil and fire theCallUserDisconnectedWebhook
event. (See the OAuth2 disconnects_helper.rb for reference.)
Modify models/plain/imap_provider.rb
(5 minutes)
- 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
anddisconnects_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.
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.
Sounds good. :+1: