If your code running on the user’s computer can use the secret provided by the user to access email, your code can steal the secret.
Running the encryption no the user’s computer instead of your own servers is not a panacea, because you still control the code.