Closed Bug 1500105 (owl) Opened 6 years ago Closed 5 years ago

Exchange AutoDiscover and addon setup in account creation dialog

Categories

(Thunderbird :: Account Manager, enhancement, P1)

enhancement

Tracking

(thunderbird_esr6065+ fixed, thunderbird65 fixed, thunderbird66 fixed)

RESOLVED FIXED
Thunderbird 66.0
Tracking Status
thunderbird_esr60 65+ fixed
thunderbird65 --- fixed
thunderbird66 --- fixed

People

(Reporter: BenB, Assigned: BenB)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(2 files, 4 obsolete files)

The Thunderbird account creation dialog that automatically finds the email server configuration, but we so far don't support Exchange.

Support the AutoDiscover method of Exchange servers. It allows to find the Exchange server hostname, which is typically a very odd local name like mex09.example.com that cannot be guessed.

The AutoDiscover returns an XML document that describes various protocols that are supported. IMAP may be one of them. If so, offer an IMAP config.

If the server only supports Exchange-only protocols, offer to install a Thunderbird addon that supports these protocols, and (if accepted by the user), then use this to set up the account.
Alias: owl
* Exchange AutoDiscover protocol implementation
* Try to find IMAP servers in the result, or based on the hostname from there
* Offer Owl extension which supports the Exchange OWA protocol to get mails
* OWA is supported by most Exchange installations, while other protocols
  are often not enabled against the Internet.
Run all the ISP config lookup network calls in parallel. Then, after they return, choose the best config.

Class ParallelAbortable simply runs all calls in parallel. Class PriorityOrderAbortable also implements a policy that waits until one of of the better calls returns successfully, then takes that result and cancels all lesser desirable calls that are still pending.

That means e.g. the MX call call already start at the very beginning, but if the normal DB lookup returns (which is better), and the MX call hasn't finished yet, we'll abort the MX callm and use the result from the normal DB call.
TODO:
* Server fetches trigger password prompt, they should not. Possibly related to redirects.
* Styling and sizing of addon [Install] button and text
* Smaller issues
> * Server fetches trigger password prompt, they should not

Fixed
This can be tested with an hotmail/live/outlook.com account, but to test with outlook.com or Rackspace, you need to set a few prefs in your Thunderbird test profile, because Outlook is in the ISP DB and we prefer that.

mailnews.auto_config.guess.enabled = false
mailnews.auto_config_url = ""
mailnews.mx_service_url = ""
security.pki.distrust_ca_policy = 0

Rackspace is a big hoster and therefore in our ISP DB. we prefer configs from ISB DB, so my new code doesn't even trigger. you need to disable the ispdb etc. in a real world scenario, the exchange server would be a small corporate server and not in the ISP DB. So, the prefs simulate this.
(Finally, the CA pref is for a Rackspace server with an old Symantec cert, which Firefox trunk already distrusts, but Firefox release not yet.)
No longer blocks: 1500316
Attachment #9018279 - Attachment is obsolete: true
Blocks: 1503719
Blocks: 1503716
Comment on attachment 9018521 [details]
Support Exchange AutoDiscover and parallelize network calls

Neil r+
aceman r+
Since this contains two (or more) separate issues, could you make them separate patches? One for detecting exchange, and one to figure out the path from there.

As it stands the second part is not acceptable, and will need more work. Those iterations could be more easily done as a separate patch.
All review requests are implemented.
Is there some public server somewhere that requires owl? I mean something so I can try it out in practice.
@Magnus: see comment 7.
Ok, I thought I'd seen something about that, but couldn't find it earlier. 
But no known services to test with without setting prefs?
Attachment #9018521 - Attachment description: Parallelize network calls → Support Exchange AutoDiscover and parallelize network calls
No, because I tried very hard to have a config for all public ISPs in the ISPDB. Our coverage (of public ISPs) is too good :).
Blocks: 1511571
* Parallelize network calls
* Exchange AutoDiscover protocol implementation
* Try to find IMAP servers in the server response
* Offer to install an extension which supports the Exchange protocol to get mails

Runs all the ISP config lookup network calls in parallel.  Class PriorityOrderAbortable (subclass of ParallelAbortable) implements a policy that waits until one of the calls returns successfully, then takes that result and cancels all pending less desirable calls.

Implements the Exchange AutoDiscover protocol to detect Exchange servers. If the server gives an IMAP configuration, we offer that to the user. Alternatively, we offer a compatible verified extension that implements the specific Exchange protocol that the Exchange server returned. Exchange has at least 4-5 proprietary protocols, and we show extensions that support the protocols that the server listed and that are known to work well and actively maintained. The setup process then continues without interruption.
Attachment #9031094 - Attachment description: Support Exchange AutoDiscover and parallelize network calls → Support Exchange AutoDiscover and parallelize network calls - TB 60
Attachment #9031094 - Attachment description: Support Exchange AutoDiscover and parallelize network calls - TB 60 → Support Exchange AutoDiscover and parallelize network calls - TB 60 backport
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/1403c0fa3d1a
Support Exchange AutoDiscover and parallelize network calls. r=aceman,mkmelin,Neil
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: Thunderbird 60.0 → Thunderbird 66.0
As we already know, the Germans can't speak German any more, let alone write it:

"Eule ist eine Erweiterung von einem Drittanbieter, die Ihnen erlaubt, Exchange server zu benutzen. Sie ist kostenpflichtig. Die Preise finden sie auf der Website."

Two mistakes in three sentences :-(

Compound nouns in German are written in either one word or with hyphens: Exchange-Server. The other mistake is obvious. It's only a comment, so not user facing.
Fixed. (The production version already had "Exchange-Server".)
Fixed where?
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/480eb7e81d39
Follow-up: Fix typos in German text in comment. rs=typo-fix-only DONTBUILD
Depends on: 1514370
No longer depends on: 1514370
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/2a6b32ef3fb6
[autoconfig] Make domain bold. r=aceman
Grrr, that landed with the wrong bug number:

https://hg.mozilla.org/comm-central/rev/844f685dc9560a2b857c30a75d72df30f43e8930
Backed out changeset 2a6b32ef3fb6 for landing with the wrong bug number. a=backout
Comment on attachment 9018521 [details]
Support Exchange AutoDiscover and parallelize network calls

Should get this into beta eventually.
Attachment #9018521 - Flags: approval-comm-beta+
Comment on attachment 9031094 [details]
Support Exchange AutoDiscover and parallelize network calls - TB 60 backport

You should ask for approval and not leave the management to me. These flags are vital, without them, the uplift won't happen.
Attachment #9031094 - Flags: approval-comm-esr60?

You're making this a little painful :-(

Ben told me to get the patches from this try run:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=a141ab4f4e83bdaba447e4a0a330fc61311821b3

So I'm comparing D14408 here to https://hg.mozilla.org/try-comm-central/rev/df29a6d4527c977595099ce46e6dd902d2ca1599 and they are quite different :-( - Most strikingly, the try changeset has string changes:
mail/locales/en-US/chrome/messenger/accountCreation.dtd
mail/locales/en-US/chrome/messenger/accountCreation.properties

Please provide proper HG patches or somewhere to get them from. This try run can't be it.

I'll stop here now since if I can't land the base patch, there's nothing to do right now.

Flags: needinfo?(neil)
Flags: needinfo?(ben.bucksch)
Attachment #9031094 - Attachment is obsolete: true
Attachment #9031094 - Flags: approval-comm-esr60?

And can you please provide all patches with 8 lines context so I can compare them. It's tedious to apply them, refresh them, then apply the other one, refresh it and then finally compare :-(

Most strikingly, the try changeset has string changes

Yes, that's a mistake, D14408 does not, Neil must have picked the wrong patch. Sorry that I didn't catch that.

Flags: needinfo?(ben.bucksch)

I'm sorry for my mistake, I'll redo the Try run with the correct patch this time...

Flags: needinfo?(neil)

I'm testing it, and I've got an error. Investigating.
Please don't merge yet.

Attached patch Fix, v38, for TB60 (obsolete) — Splinter Review

I found a small problem with an API change: Services.locale.getRequestedLocale() on ESR60 instead of .requestedLocale on trunk. Otherwise, it works.

I've tested it and it works as expected.

Attached patch Fix, v38, for TB 60 (obsolete) — Splinter Review

(with HG header, manually created, I hope it works)

Attachment #9037626 - Attachment is obsolete: true
Attached patch Fix, v38, TB60Splinter Review

(...and -U8 context 8 lines)

Attachment #9037630 - Attachment is obsolete: true
Attachment #9037632 - Flags: approval-comm-esr60?

(In reply to Ben Bucksch (:BenB) from comment #36)

I found a small problem with an API change: Services.locale.getRequestedLocale() on ESR60 instead of .requestedLocale on trunk. Otherwise, it works.

I knew that ;-) - How's the state of the other patches? I can see two try runs
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=31538f4ad208dce05f259a8ae38a74c9b5a4b118
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=eeb49d8b015520455369ddf697b2fd0e86a646d6

BTW, they do include the "bold" bug.

they do include the "bold" bug.

https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=eeb49d8b015520455369ddf697b2fd0e86a646d6
does not include the "domain bold" patch. I've verified that in:
https://hg.mozilla.org/try-comm-central/file/eeb49d8b015520455369ddf697b2fd0e86a646d6/mail/components/accountcreation/content/emailWizard.js#l965
It does include the patch for this bug, even though it does not show in the list, because the identical patch has in the first try build and hg then doesn't show it, but it's in this try build:
https://hg.mozilla.org/try-comm-central/file/eeb49d8b015520455369ddf697b2fd0e86a646d6/mail/components/accountcreation/content/exchangeAutoDiscover.js

The domain bold bug is optics only, has nothing to do with Exchange, and is optional, we can leave it out.


I've tested all the patches (aside from the domain bold patch) together in a build, ran my standard manual tests, and they all work fine, as far as I could see.

My mistake, ...b118 had the bold patch, and for ....46d6 I incorrectly assumed I had, too. Sorry.

OK, so for the record: We go with the ESR60 patch here, plus the five changesets from
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=eeb49d8b015520455369ddf697b2fd0e86a646d6
As discussed, they don't include the "bold" thing ;-)

Right?

Right.

Once you merged it, we can test the builds.

Comment on attachment 9037632 [details] [diff] [review]
Fix, v38, TB60

Thanks, I compared to Neil's try, only difference: The correction of the locale thing.
Attachment #9037632 - Flags: approval-comm-esr60? → approval-comm-esr60+

Thanks so much for merging this! This is a huge relieve for me!

I've downloaded the TB 60.5 build
treeherder: https://treeherder.mozilla.org/#/jobs?repo=comm-esr60&revision=acaf08e72ead14783d06d0cd8f14431b31ba3b97&selectedJob=223017085
Linux: https://queue.taskcluster.net/v1/task/DCetzb2GRWqQT5A_x3LK9Q/runs/0/artifacts/public/build/target.tar.bz2
and tested it, and it all works as expected.

Most accounts (even outlook.com etc.) have IMAP configs in our ISPDB, and they are still give IMAP configs as expected.
To emulate hosted on-premise Exchange servers for small domains, I disabled the ISPDB (see comment 7), and then we detect the AutoDiscover and everything works as expected. I tried 5 Exchange accounts on different servers, and they all were properly detected, automatically configured, and worked.

If you do happen to find something catastrophically wrong, please add it to bug 1514627 (alias exchange-meta). I will stand by in ready mode and will try to fix any severe and real problems that might be found right away.

Regressions: 1611405
Regressions: 1735983
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: