Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all apps recognise Tutanota as the default mailto application in windows #3574

Closed
14 of 20 tasks
johnbotris opened this issue Oct 19, 2021 · 24 comments · Fixed by #3715, #3814 or #3840
Closed
14 of 20 tasks

Not all apps recognise Tutanota as the default mailto application in windows #3574

johnbotris opened this issue Oct 19, 2021 · 24 comments · Fixed by #3715, #3814 or #3840
Labels
bug broken functionality, usability problems, unexpected errors desktop Desktop client related issues state:done meets our definition of done state:tested We tested it and are about to release it
Milestone

Comments

@johnbotris
Copy link
Contributor

johnbotris commented Oct 19, 2021

We register tutanota as the default mailto by setting the registry keys under HKEY_LOCAL_MACHINE > SOFTWARE > Clients > Mail, but there are other choices like HKEY_CURRENT_USER > SOFTWARE > Clients > Mail. It seems like not all apps check the same key, for example MS Word is always opening in MS Outlook

Update

We decided to change the approach because having two places where we can write registry keys leads to some problems (see #3787). Instead of deciding on HKEY_LOCAL_MACHINE vs HKEY_LOCAL_USER we will always use HKEY_LOCAL_USER to write registry keys (the only reason to not do that is for the admin to set mailto handler for all users but admin has other means to do that should they wish to).

Acceptance criteria

  • Enabling integration in Tutanota settings writes Tutanota as available mailto:/MAPI handler for current user, it doesn't affect other users
    • per-user install
    • per-machine install
  • Disabling it removes Tutanota from default and removes Tutanota from the list of available mailto: handlers for current user, it doesn't affect other users
    • per-user install
    • per-machine install

Testing

Two users, A and B

  • Install locally for A, set mailto handler
    • mailto: for A is handled
    • MAPI works for A
    • user B is unaffected
  • uninstall locally, install globally, run for A
    • mailto: for A is handled
    • MAPI works for A
    • user B is unaffected
  • Run as B, enable integration
    • mailto: for A is handled
    • MAPI works for A
    • mailto: for B is handled
    • MAPI works for B
  • Setting default download folder (at least on one system)
@johnbotris johnbotris added the dev bug unpublished bugs, found during our development/test cycle (excluded from release notes) label Oct 19, 2021
@johnbotris johnbotris added this to the 3.89.0 milestone Oct 19, 2021
@charlag
Copy link
Contributor

charlag commented Oct 19, 2021

The situation is... complex cc @ganthern
https://superuser.com/a/1119010/267277

@ganthern
Copy link
Contributor

this specific case could have been caused by thunderbird not clearing that key when it was deinstalled and word falling back to outlook when it failed to locate the handler.

we still need to look at handling default mail handler differently for a gobally installed tutanota vs a per-user install

@sarashub sarashub modified the milestones: 3.89.0, Next release Oct 19, 2021
@johnbotris johnbotris added bug broken functionality, usability problems, unexpected errors and removed dev bug unpublished bugs, found during our development/test cycle (excluded from release notes) labels Oct 21, 2021
@johnbotris johnbotris added the desktop Desktop client related issues label Oct 27, 2021
@macxcool
Copy link

@ganthern Let me know if there's anything you want me to try. I have access to a Windows 10 VM that I can roll back and do things to. I think the Thunderbird angle is a red herring. I have some details on what I've tried in #3602 that @johnbotris closed.

@ganthern
Copy link
Contributor

ganthern commented Oct 28, 2021

Hey @macxcool, it's certainly possible that Thunderbird has nothing to do with your problem. There's a number of ways the MAPI can be used to send mail, and we couldn't test all of the applications. This may go too much into detail, but all the apps we tested were happy to just call MAPISendMail and ignore the option to have a session-based interaction. That's why we implemented that function and decided to log calls to the others.

You can find the logs in C:\Users<your username>\AppData\Roaming\tutanota-desktop\logs\mapi.log, It should look like this if Sage actually can't find the dll but others (i.e. the file explorer) can use it:

2021-10-28 | 16:30:45.242 | mapisendmail: parsed message, sending...
2021-10-28 | 16:30:45.254 | make_mailto: mailto:?subject=Emailing%3A%20tutanota_desktop.log&body=Your%20message%20is%20ready%20to%20be%20sent%20with%20the%20following%20file%20or%20link%20attachments%3A%0D%0D%0Atutanota_desktop.log%0A%0D%0D%0D%0ANote%3A%20To%20protect%20against%20computer%20viruses%2C%20e-mail%20programs%20may%20prevent%20sending%20or%20receiving%20certain%20types%20of%20file%20attachments.%20%20Check%20your%20e-mail%20security%20settings%20to%20determine%20how%20attachments%20are%20handled.&attach=C%3A%5CUsers%5Cnig%5CAppData%5CLocal%5CTemp%5Ctutanota%5Cattach%5Ctutanota_desktop.log
2021-10-28 | 16:30:45.266 | send_mail: spawned tutanota client
2021-10-28 | 16:30:45.267 | mapisendmail: sent message!

If there are any lines that contain date | time | mapi*: that are not mapisendmail, Sage probably tries to use some of these other functions and we'll have to implement them.

We'll also reduce the make_mailto: log verbosity while we're at it, that's a little TMI.

Another thing: It could help if you're aware of a free trial for your specific Sage version that we can use to test.

@macxcool
Copy link

Thanks @ganthern

OK. I can verify that Thunderbird sets HKCU:\SOFTWARE\Clients\Mail (Default)='Mozilla Thunderbird' and if it isn't at least blanked, right-click -> Send to -> Mail recipient goes to Thunderbird anyway, even if Tutanota is set as the default handler. If that default value is blanked (or set to literally anything ;-) ) the mail is sent via Tutanota.

I did a fresh install of Thuderbird, Tutanota and Sage 50 and Sage isn't sending to Thunderbird either, even when it's the default handler. The same message I posted before happens regardless of what I do. I don't get entries in Tutanota's MAPI log for this.

Man is Windows annoying! This is why I use Linux. The problem is that I recommended that a client purchase a Tutanota subscription and I want to get this working for her and uninstall Thunderbird completely. Thankfully she has an SMTP server still with the same domain name so things are working for now. Sage 50 sends through Thunderbird on her computer, even though I can't get even that working on mine.

@macxcool
Copy link

@ganthern Does a dump from Procmon with just calls from Sage during such a MAPI request interest you?

@ganthern
Copy link
Contributor

@ganthern Does a dump from Procmon with just calls from Sage during such a MAPI request interest you?

That would at least be interesting to look at, thank you.

Could you please confirm if you install Tutanota globally or per-user ("only for me")? I may have missed that.

Also, if you want to try other apps, LibreOffice and Adobe Acrobat Reader are also making MAPI calls.

@macxcool
Copy link

macxcool commented Oct 28, 2021

I installed it globally.
Oh. Good. I'll try both of those. Since it's a VM I can easily roll back and try other types of installs too, if you like. This client uses both of those, so it's an interesting test anyway.

@ganthern
Copy link
Contributor

Since it's a VM I can easily roll back and try other types of installs too, if you like.

That would be lovely, the mapi registration in Tutanota doesn't distinguish between global and per-user install currently.
Maybe some apps do like to check different keys depending on how the handler is installed.

Man is Windows annoying! This is why I use Linux.

no arguments here ;)

@macxcool
Copy link

OK. I have the Sysinternals Process Monitor log here: http://u.pc.cd/Bb2rtalK The password is 'ThisIsAThing'. This is for Sage 50 trying to send an Invoice via MAPI. I tried to make the capture as narrow as possible.

@macxcool
Copy link

macxcool commented Oct 28, 2021

Adobe Reader says: "There is no email program associated to perform the requested action" when I've blanked or whatevered that registry key. If the key says 'Mozilla Thunderbird' it works with Thunderbird even though Tutanota is registered and set as the Default handler. http://u.pc.cd/466 same password.

@macxcool
Copy link

BTW, I tried setting that registry key to all kinds of things, like 'Tutanota', 'tutanota' (not that Windows cares about case), 'Tutanota Desktop', etc. Nothing seemed to make a difference.

@macxcool
Copy link

macxcool commented Oct 28, 2021

Libreoffice does work without that key. Nice!

2021-10-28 | 13:44:06.009 | mapisendmail: parsed message, sending...
2021-10-28 | 13:44:06.013 | make_mailto: mailto:?subject=noname&attach=C%3A%5CUsers%5CTV45057%5CAppData%5CLocal%5CTemp%5Ctutanota%5Cattach%5Cnoname.odt
2021-10-28 | 13:44:06.074 | send_mail: spawned tutanota client
2021-10-28 | 13:44:06.075 | mapisendmail: sent message!

If the key is set to 'Mozilla Thunderbird', though, the mail goes through Thunderbird. I think we need to at least blank that key or check to see if it exists or the Default is set to 'Mozilla Thunderbird'.

@ganthern
Copy link
Contributor

ganthern commented Nov 2, 2021

okay, seems like we need to be more judicious in applying the registry keys.

again, thank you for your effort!

@ganthern
Copy link
Contributor

ganthern commented Nov 18, 2021

So, in my tests, the demo version of Sage50 seems to be OK with a per-user install and a global install of tutanota in a fresh Win10 VM (if it doesn't choke on date formats and refuses to run at all).

  • install tutanota desktop
  • register as mail handler from settings
  • set default mail handler in windows settings to tutanota
  • install Sage50 with all options
  • use the dummy data to create an invoice or offer
  • "Abschließen" -> "Mailen..."
  • works almost as expected: Sage writes the mailto mail address as SMTP:info-gs@sage.de which gets rejected by tutanota desktop due to the SMTP: prefix and replaced by an empty address. otherwise the attachment works fine.

I'll test this again with a system that has been "tainted" by thunderbird, but so far I can't see a fundamental problem.

ganthern added a commit that referenced this issue Dec 2, 2021
* a per-user install should only write into HKEY_CURRENT_USER so other users
can't select an app that's not installed for them as default mail app
* the app now opens the settings page after registering as a mail handler so
the user can select it

#3574
@ganthern
Copy link
Contributor

ganthern commented Dec 2, 2021

The registry entries for registering as a mail handler should be a little more well-behaved with #3715

Testing

on a fresh windows machine with two users A and B: install tutanota desktop for A per-user and register/set it as the default mail handler, then check:

  • user A can use Send as mail feature and mailto links with tutanota
  • user B can not select tutanota as a mail handler in the settings
  • mapi logs still get written to %APPDATA%\tutanota-desktop-test\logs

unregister, then uninstall tutanota and then reinstall per-machine

  • user A and B can select tutanota as default mail app
  • both can use Send as mail feature and mailto links with tutanota

@macxcool
Copy link

macxcool commented Dec 2, 2021

Will do. Probably tomorrow.

@ganthern
Copy link
Contributor

ganthern commented Dec 3, 2021

@macxcool, the checklist is part of our testing processes for the next release. It would be better to wait for the PR being merged, since this one depends on another PR in a different repo.

charlag added a commit that referenced this issue Jan 18, 2022
Also clean up the code a bit, remove unused code, do not attempt to
register on Linux as it doesn't work.
@sarashub sarashub added the state:done meets our definition of done label Jan 18, 2022
charlag added a commit that referenced this issue Jan 18, 2022
Also clean up the code a bit, remove unused code, do not attempt to
register on Linux as it doesn't work.
@charlag charlag removed their assignment Jan 18, 2022
@sarashub sarashub reopened this Jan 19, 2022
@sarashub
Copy link
Contributor

MAPI is not working for local install (windows 10)

@charlag charlag modified the milestones: 3.91.2, 3.91.3 Jan 20, 2022
@charlag charlag removed the state:done meets our definition of done label Jan 20, 2022
@charlag
Copy link
Contributor

charlag commented Jan 20, 2022

We discovered that it is somehow related to the .dll built on Windows machine. .dll built via Wine is bigger but works.

@charlag
Copy link
Contributor

charlag commented Jan 26, 2022

Should be fixed by depending on this release:
https://github.com/tutao/mapirs/releases/tag/mapirs-release-0.4.0

@charlag charlag closed this as completed Jan 26, 2022
@sarashub sarashub self-assigned this Jan 26, 2022
@charlag
Copy link
Contributor

charlag commented Jan 26, 2022

Clean global install, attempt to register:

Stacktrace:
Error: EPERM: operation not permitted, open 'C:\Program Files\test Tutanota Desktop\99dc225701c4bd5289ae99e7'

it seems like we still need to elevate permission to register when it's a global

@charlag charlag reopened this Jan 26, 2022
@sarashub sarashub removed their assignment Jan 26, 2022
@charlag charlag modified the milestones: 3.91.3, 3.91.4 Jan 26, 2022
@ganthern
Copy link
Contributor

Clean global install, attempt to register:

Stacktrace:
Error: EPERM: operation not permitted, open 'C:\Program Files\test Tutanota Desktop\99dc225701c4bd5289ae99e7'

it seems like we still need to elevate permission to register when it's a global

This is happening because the client tries to write the registry script it needs to execute into its execPath, which is in C:/Program Files for global installs and read-only for normal users.

Putting it into the tutanota tmp directory should fix this.

@johnbotris
Copy link
Contributor Author

Documents sent from applications such as LibreOffice aren't being attached

@johnbotris johnbotris reopened this Jan 27, 2022
@johnbotris johnbotris added the state:tested We tested it and are about to release it label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug broken functionality, usability problems, unexpected errors desktop Desktop client related issues state:done meets our definition of done state:tested We tested it and are about to release it
Projects
None yet
5 participants