how to set up firefox to use a mailto link to a webmail account (not gmail, or yahoomail, just a custom webmailaccount ...)
I want to setup firefox to ask me, or directly to switch to a webmailaccount and start an email, if I use a MAILTO link. I can not setup this, the only add-ons are for gmail or yahoomail , but I can not find a solution for a custom webmail address. On another PC I got a question from firefox if I want to define this link, an on this PC Mailto is working. On my working PC I also want to set up this function, but I can not manage to do it. can anybody help?
Chosen solution
Here is the usual method:
Let's say the compose address is something like:
https://mail.example.com/compose?to=%s
(1) Open your mailbox or another page on mail.example.com
(2) Open Firefox's Web Console in the lower part of the tab below your mailbox. You can do that using either:
- Ctrl+Shift+k (Mac: Command+Alt+k)
- "3-bar" menu button > Web Developer > Web Console
- (menu bar) Tools > Web Developer > Web Console
If you have not used the Web Console before, you need to prime it. Next to the caret (>>) at the bottom of the Web Console, type Date
and press Enter. (If there is a Run button above the console, click the run button.)
Firefox usually will ask you to take some action to prove you understand it's dangerous to run scripts from strangers. Complete that task to enable the console.
(3) Select and copy the following line of script (it's all one line):
navigator.registerProtocolHandler('mailto', 'YourLinkHere', 'HandlerNameHere');
(4) In the tab with your mailbox, paste the script next to the caret (>>) at the bottom of the Web Console.
Edit the script with the information you found from the other system. Make sure to keep the single quotation marks around the text strings.
Then press the Enter key to run the script. Or if there is a Run button above the command line, click the run button.
(5) An infobar should open above the page just below the toolbar area asking you to confirm. Click "Add Application". (Example screenshot attached.) You now can close the Web Console by clicking the "X" on its top bar at the right.
Success?
Read this answer in context 👍 1All Replies (10)
Hi f.s3, please ignore the spam message promoting an unofficial phone number.
Firefox has a standard way that it sends address information (or page title and URL information for Email Link) to webmail sites. The best way to add the new address to the mailto handlers list is from the site itself, if it offers the ability to add it to your browser.
Unfortunately, because each site is different, we would need more information to help you set up the site yourself. In particular, you need to determine the URL for composing a new message. As an example:
https://mail.example.com/compose?to=john@example.com
Then I can give you the half dozen steps to plug that compose URL into Firefox.
f.s3 said
On another PC I got a question from firefox if I want to define this link, an on this PC Mailto is working.
Probably, Firefox saved that in a file in your profile folder on that PC, called handlers.json, so we could learn from that one.
To see what the compose URL is on the other PC, open the handlers.json file in a Firefox tab. Here's how:
Open your current Firefox profile/settings folder using either
- "3-bar" menu button > "?" Help > Troubleshooting Information
- (menu bar) Help > Troubleshooting Information
- type or paste about:support in the address bar and press Enter
In the first table on the page, on the Profile Folder row, click the "Open Folder" button. This should launch a new window listing various files and folders in Windows/File Explorer.
Position the window so you can see part of the Troubleshooting Page behind it. Drag and drop handlers.json from File Explorer into the tab.
After a moment, Firefox will display a structured view of the data in the file. If you use Find (Ctrl+f) for mailto Firefox should skip down to the relevant section. Here you should find the critical compose URL.
Any luck?
jscher2000 said
Any luck?
Thank You! This was a clear instruction and I found the handler and the link. how can I enter this link to work with mailto?
Chosen Solution
Here is the usual method:
Let's say the compose address is something like:
https://mail.example.com/compose?to=%s
(1) Open your mailbox or another page on mail.example.com
(2) Open Firefox's Web Console in the lower part of the tab below your mailbox. You can do that using either:
- Ctrl+Shift+k (Mac: Command+Alt+k)
- "3-bar" menu button > Web Developer > Web Console
- (menu bar) Tools > Web Developer > Web Console
If you have not used the Web Console before, you need to prime it. Next to the caret (>>) at the bottom of the Web Console, type Date
and press Enter. (If there is a Run button above the console, click the run button.)
Firefox usually will ask you to take some action to prove you understand it's dangerous to run scripts from strangers. Complete that task to enable the console.
(3) Select and copy the following line of script (it's all one line):
navigator.registerProtocolHandler('mailto', 'YourLinkHere', 'HandlerNameHere');
(4) In the tab with your mailbox, paste the script next to the caret (>>) at the bottom of the Web Console.
Edit the script with the information you found from the other system. Make sure to keep the single quotation marks around the text strings.
Then press the Enter key to run the script. Or if there is a Run button above the command line, click the run button.
(5) An infobar should open above the page just below the toolbar area asking you to confirm. Click "Add Application". (Example screenshot attached.) You now can close the Web Console by clicking the "X" on its top bar at the right.
Success?
jscher2000 said
Success?
After a little bit of misspelling i finally managed it. Thank You! for this detailed step by step instructions!
Regarding the script: navigator.registerProtocolHandler('mailto', 'YourLinkHere', 'HandlerNameHere'); YourLinkHere seems obvious but what is HandlerNameHere supposed to hold? I thought it might be the name of the application I want to show in the list but I get an error:
navigator.registerProtocolHandler('mailto', 'https://foobar.com:2096/cpsess0878181/horde/imp/dynamic.php?page=compose', 'MSI Email');
Uncaught DOMException: Navigator.registerProtocolHandler: Handler URI does not contain "%s".
Thanks Doug
dougm4 said
Uncaught DOMException: Navigator.registerProtocolHandler: Handler URI does not contain "%s".
Hi Doug, there needs to be a %s in the URL where you want Firefox to insert the information it is sending to the site (the to address for mailto: links or page title/URL for the Email Link feature).
For email webapps, it's usually more like
https://mail.example.com/compose?to=john@example.com
(The %s goes in place of john@example.com)
I don't know what kind of script you are working with or how it expects to receive the information.
Modified
I use hostgator as a domain host and its email server via the horde email app. Im using a web program called SuiteCRM (a fork of SugarCRM) that has mailto links in it. When I click mailto, it pops open a new window to my webhost and gives me a token error: HTTP error 401 Invalid Security Token The requested URL does not contain your session’s correct security token.
You may have reached this error by copying and pasting a URL from a different cPanel, WHM, or Webmail session into your browser’s address bar. To resolve this situation, please take one of the following steps:
Go back one page and reload the URL, making sure that the /cpsess … / section of the URL remains the same. Re-enter your account’s password below. This will assign your session a new security token. This new token will prevent you from using other pages of this application that may be open in other tabs. Request information Requested page: horde/imp/basic.php
Parameter name Parameter value actionID mailto_link page compose to mailto:admin???@gmail.com u 10231723835ed941d9c5g
So I am trying to use this mailto workaround to setup a new application to choose as the webmail app in Firefox to open up a compose window.
Hi Doug, if the cpsess part of the URL can vary from day to day, then I don't think the standard mailto URL approach will work unless there is a more general address you can use that will redirect to your current session.
Also, the current link might be coded in a way that bypasses Firefox's default mailto handling. If you check on the Options/Preferences page, and set mailto to "Always Ask" does Firefox pop up an application chooser when you hit the link in SuiteCRM? If not, it may not be a mailto link but a regular hyperlink.
It does give the popup choice to pick an application after setting Always Ask. From what I can tell, it is a unique code everyday and every login. I can have an email tab running all day but then go to login from another browser and my old link will tell me I have an invalid token and I have to log back in. So I must have some setting enabled on the server. I'll go back to that and see if I can figure it out.
Thanks