如何通过邮件传递非HTTP协议URL?brushit协议链接失效求助
brushit://user_id=10 Link in Emails Hey there! I’ve dealt with similar custom protocol link issues in emails before—let’s break down why your link isn’t working and walk through actionable fixes.
1. Email Client Security Restrictions Are Blocking the Link
Most major email clients (Gmail, Outlook, Apple Mail, etc.) block custom protocol links by default to protect users from malicious redirects. They might strip the link entirely, or prevent it from triggering a redirect when clicked.
Fixes for This:
- Guide users to copy-paste the link manually: Add a clear note in your email like: "If the link doesn’t open automatically, copy
brushit://user_id=10and paste it into your browser’s address bar to launch the app." - Use a self-hosted HTTP redirect page: Create a simple static webpage with a button that triggers the custom protocol when clicked. For example, add this JavaScript to the page:
Then link to this HTTP page in your email. Most clients allow HTTP links, and users can click the button on the page to launch the app.document.getElementById('open-app-btn').addEventListener('click', () => { window.location.href = 'brushit://user_id=10'; });
2. The brushit Protocol Isn’t Registered on the User’s Device
If the user’s device doesn’t have an app installed that’s registered to handle the brushit:// protocol, the system won’t know how to process the link.
How to Verify & Fix:
- First, test the link in your browser (paste
brushit://user_id=10into Chrome/Firefox). If it doesn’t open your app here either, the protocol isn’t registered correctly. - Register the protocol for each platform:
- Windows: Add entries to the Windows Registry under
HKEY_CLASSES_ROOT\brushitto map the protocol to your app’s executable path. - macOS: Update your app’s
Info.plistto include aCFBundleURLTypesentry withCFBundleURLSchemesset tobrushit. - Android: Add an
<intent-filter>to your app’s manifest for the activity that should handle the protocol:<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="brushit" /> </intent-filter>
- Windows: Add entries to the Windows Registry under
3. Link Format or Email Editor Glitches
Sometimes email editors mangle custom protocol links, or the parameter format doesn’t match what your app expects.
Quick Checks:
- Double-check your HTML for typos or extra spaces:
<a href="brushit://user_id=10">Click to Open App</a> - Try formatting parameters as a query string (some apps expect this structure):
<a href="brushit://?user_id=10">Click to Open App</a> - If using a WYSIWYG email editor, avoid pasting raw HTML directly—use the editor’s "Insert Link" tool to input the
brushit://URL, as some editors filter or modify raw HTML code.
内容的提问来源于stack exchange,提问作者test qa

