Full Page History:

Oldest known version of this page was edited on 2011-07-21 00:18:11 by BurnOut426 []

Page view:

Specifying Webmail Services as the mailto: Protocol Handler (webmailproviders.ini) In Opera

If you use a webmail service like Gmail, Ymail, Hotmail or Fastmail, you may want clicking on mailto: links in webpages to open up a compose page for your webmail with the form fields filled in. That way, you don't have to copy the info from the link and paste it into the form manually.

In Opera, you can now do this. Goto "tools -> preferences -> advanced -> programs -> mailto -> edit -> Use a webmail service" and choose your webmail from the available dropdown. Then, invoking mailto links should open up your webmail's compose page and fill in the fields with the specified data, if any.

Where are the settings stored?

The settings are stored in "defaults/webmailproviders.ini" in your Opera install directory. For example:

On Windows, this might be "C:\Program Files\Opera\defaults\webmailproviders.ini".

On Mac, this might be "Resources/defaults/webmailproviders.ini" once you show the package contents of Opera's .app file.

Currently, the file applies to all Opera profiles. Putting a webmailproviders.ini in your Opera profile directory doesn't do anything.

Also, there's currently no user interface to add support for other webmails. You can manually edit the file to add your own entries (and restart Opera to load them) though.

Also note that webmailproviders.ini is currently wiped out on upgrades. So, you will have to re-add extra entries when upgrading. You *might* be able to write-protect the file to stop it from getting overwritten on upgrades though, but then you won't get any new entries that Opera might add.

Note that webmail support is a relatively new feature in Opera and is in its initial stage. More features and fixes may come later.

Syntax of webmailproviders.ini

Each entry looks like this:

[My Webmail Description]
ID=N
URL=Compose URI for the webmail
ICON=URI to favicon for the site

N = N_FROM_PREVIOUS_ENTRY + 1.

The compose URI format for each webmail is different. It might look like :

http://example.org/compose.php?uri=

or might look like:

http://example.org/compose.php?to=&subject=&body=&cc=&bcc=

Now, there needs to be some way to get data from the mailto link into the compose URI so that the webmail server actually sees the data. You do this with replacement keys, which contain percent-encoded values (so they can go in query strings and be interpreted as data).

These are the currently supported keys.

%t = to - email%40example.com
%j = subject - test%20email
%m = body - line1%0D%0Aline2
%k = cc  - email%40example.com
%l = bcc - email%40example.com
%s = full mailto URI - mailto%3Aemail%2540example%2Ecom%3Fsubject%3Dtest

So, using the replacement keys, the above compose URIs would look like this:

http://example.org/compose.php?to=%t&subject=%j&body=%m&cc=%k&bcc=%l
http://example.org/compose.php?uri=%s

Note that %t, %j, %m, %k and %l are just workaround keys used for webmails that don't support %s. %s is what HTML5's registerProtocolHandler emits and is what webmails are expected to support to be supported by Firefox (Firefox's registerProtocolHandler documentation) and Opera.

Webmails are strongly urged to support %s for the best compatibility. Supporting %s means taken 'hvalue' in compose.php?uri=hvalue, utf-8-percent-decoding it to get the mailto URI and then parsing and utf-8-percent-decoding its parts to get the field values. See consuming mailto URIs for how to parse the mailto URI into the field values. Or, see mailto_protocol_handler.php in the SquirrelMail? section below to see example code for supporting %s.

Note that the data sent out in the generated compose URI uses percent-encoded UTF-8. If the webmail's pages don't use UTF-8, it is up to the webmail to convert UTF-8 to the encoding its pages use.

Note that although other URI schemes may work as a compose URI, only http and https are officially supported.

Also note that there's currently no way to make a POST request yet. Only GET is currently supported. However, webmails are urged to support *both* POST and GET.

Also note that Opera won't load ICON files for non-supported webmails sometimes. You may have to Delete Private Data and or visit the webmail site first and or restart Opera.

Webmails are urged to provide the favicon.ico file at the root of the site that has the webmail compose URI. That way, in the future, Opera might be able to autodetect the icon when a site uses registerProtocolHandler, which doesn't provide a way for a site to give info on the location of its favicon.

Currently Supported Webmails

It seems (this is a guess, not an official statement from Opera) the list of webmails supported by default will only include webmails that officially support Opera.

By "officially support", that is likely to mean that:

1. Opera is listed on the site as a supported browser (along with Firefox and IE for example).

2. When new features in the webmail are released, they work in Opera from the start. None of that, "It works in Firefox and IE. Maybe we'll add Opera support in a few months" stuff. In short, Opera shouldn't be an after-thought and the design of the feature should have Opera in mind (and other browsers) from the start.

3. You must not have to use a special URI or browser.js to access the webmail. None of that ?nocheckbrowser stuff. The site must not discriminate against Opera's user agent string.

4. The webmail must accept bug reports related to browsing in the webmail in Opera. Their priority and such should be determined by the bug, not by what browser exposes it.

5. Bugs in the webmail must not require long-term fixes in browser.js. Outstanding bugs in the webmail need to be fixed in a timely manner. This of course shouldn't be an issue if #4 is honored.

6. The webmail QA and devs must work together with Opera when issues arise. No giving the runaround.

Basically, if the webmail doesn't discriminate against Opera, it's likely to be supported. If you're a webmail provider and want to "officially support" Opera, just ask.

Fastmail.fm, Yandex.ru, Mail.ru and OperaMail?.com are the webmails that currently support Opera. Fastmail and Yandex support %s, while the workaround keys are used to support Mail.ru and OperaMail?.com.

Here are the entries for them, just in case they disappear:

[Yandex]
ID=4
URL=http://mail.yandex.ru/compose?mailto=%s
ICON=http://img.yandex.net/i/favicon.ico

[Fastmail]
ID=5
URL=http://www.fastmail.fm/action/compose/?mailto=%s
ICON=http://www.fastmail.fm/favicon.ico

[Opera Web Mail]
ID=6
URL=http://mymail.operamail.com/scripts/mail/Outblaze.mail?compose=1&did=1&a=1&to=%t&subject=%j&body=%m&cc=%k
ICON=http://www.opera.com/favicon.ico

[Mail.ru] 
ID=7 
URL=http://win.mail.ru/cgi-bin/sentmsg?To=%t&CC=%k&BCC=%l&Subject=%j&BodyUTF8=%m&accel=1 
ICON=http://img.imgsmail.ru/r/favicon.ico

Gmail, Yahoo and Hotmail don't support Opera, but you can add them manually. Examples of why each of them are not supported by default and how to manually add support for them will be addressed below.

You can also manually add entries for SquirrelMail? and RoundCubeMail?. These ones can't be added by default because the compose URIs depend on what site you're running them on. But, adding support for these will also be detailed below.

Adding Support for SquirrelMail?

SquirrelMail? doesn't support %s, but supports individual variables, which you can make use of by using the workaround replacement keys.

[SquirrelMail]
ID=8
URL=http://your_squirrelmail_server/src/compose.php?send_to=%t&subject=%j&body=%m&send_to_cc=%k&send_to_bcc=%l
ICON=http://your_squirrelmail_server/favicon.ico

Now, if you want SquirrelMail? to support %s, you can add html5_mailto.php to the SquirrelMail? src directory. Then, you would use:

URL=http://your_squirrelmail_server/src/html5_mailto.php?uri=%s

Just note that html5_mailto.php has only been tested with SquirrelMail? 1.4x. It has not been tested with 1.5x.

Note: If you want to see %s support added to SquirrelMail? like html5_mailto.php does, you can request so here or here.

Adding Support for RoundCubeMail?

RoundCubeMail? doesn't support %s, but supports individual variables, which you can make use of by using the workaround replacement keys.

[RoundCubeMail]
ID=9
URL=http://your_roundcubemail_server/?_task=mail&_action=compose&_to=%t&_subject=%j&_body=%m&_cc=%k&_bcc=%l
ICON=http://your_roundcubemail_server/favicon.ico

Adding Support for Hotmail

Hotmail doesn't support %s, but supports individual variables, which you can make use of by using the workaround replacmenet keys.

[Hotmail]
ID=9
URL=http://mail.live.com/mail/EditMessageLight.aspx?n=&to=%t&cc=%k&subject=%j&body=%m&bcc=%l
ICON=http://mail.live.com/favicon.ico

Hotmail server bugs

The bcc data is ignored. This is done for privacy probably, but this should not be up to the server and should be up to the mailto URI author.

Depending on what field the data in the mailto URI is specified for, '+' and '%2B' may have to be percent-encoded 3 or more times so that they make it to the form field as '+'. This is because Hotmail decodes the data on each redirect and then reencodes it according to HTTP rules instead of mailto rules. But, this bug varies depending on the field.

The body data is treated as HTML makrup. This means that newlines (%0D%0A) in the mailto URI will come out as spaces instead of newlines. Hotmail doesn't escape all the text and put it in a <pre> for its rich text control, nor does it convert newlines to <br>. If you switch to plain text mode composition, things might work better.

Hotmail's compose URI functionality breaks and changes all the time.

Hotmail keeps blocking Opera and breaking the code Opera gets.

These bugs have all been reported to Microsoft, but they must not see these bugs as a priority as they're not fixed yet.

You're better off using just http://mail.live.com/mail/EditMessageLight.aspx?n=&to=%t and clicking on very simple mailto links until the Hotmail team gets their act together.

Also see Opera's browser.js for Hotmail bugs that Opera's currently trying to work around.

Adding Support for Gmail

First, try the Gmail Compose Extension to see if that works good enough for you. If not, see the following.

Gmail supports both %s and individual variables. So, you can use %s or the workaround replacement keys.

[Gmail]
ID=10
URL=https://mail.google.com/mail/?extsrc=mailto&url=%s
ICON=https://mail.google.com/favicon.ico

or

[Gmail]
ID=10
URL=https://mail.google.com/mail/?compose=1&view=cm&fs=1&to=%t&su=%j&body=%m&cc=%k&bcc=%l
ICON=https://mail.google.com/favicon.ico

Gmail server bugs

Gmail has problems with '+' (%2B) for the %s version. The Gmail server takes the %s value, percent-decodes it, parses the resulting mailto URI into its parts and percent-decodes each value. Then, the server re-encodes the values and puts them into the compose URI that uses the individual variables. The problem is, when re-encoding the values, the server doesn't convert '+' to '%2B' because it uses HTTP rules instead of mailto rules. The result of this bug is that + in the mailto link will come out as a space in the field. This bug has been reported to google, but still waiting for a fix.

Google still isn't treating Opera as a first-class citizen and still leaves Opera as an after thought. This means that everytime Google fixes/updates Gmail, they don't test in Opera right away and don't make sure that they're not using Gecko-only code. Because of this, Gmail is often broken in Opera for long periods of time while everyone is waiting for the Gmail team to fix things. Not only that, but when Google doesn't support Opera, they make it difficult to let Opera at least fend for itself. They block Opera and force Opera to use browser detection overrides, if they even provide any.

The HTML-only version of Gmail doesn't support a GET URI for composing. It only supports a form POST from its contacts page.

Also, see Opera's browser.js for Gmail bugs that Opera's currently trying to work around.

Adding Support for Yahoo Webmail

Ymail doesn't support %s, but it supports individual variables, which you can make use of with the workaround replacment keys.

[Yahoo]
ID=11
URL=http://compose.mail.yahoo.com/?To=%t&Subj=%j&Body=%m&Cc=%k&Bcc=%l
ICON=http://mail.yahoo.com/favicon.ico

First off, Ymail is a broken mess. If you insist on using it, don't expect anything to work. What bugs you encounter depends on whether you're using Ymail classic or the new UI and whether you're using text/plain composition mode or rich text composition mode. It also depends on whether you're using the generic compose URI above or a server-specific compose URI.

Yahoo server bugs

With the new UI enabled, Yahoo doesn't support Opera, so it redirects you to the unsupported browser page. When it does this, it discards all the compose data in the URI. Because of this, any compose data Opera sends, the server drops, so nothing makes it to the compose page.

Body data is ignored. This used to work for text/plain composition mode in Ymail classic. It also use to work in rich text composition mode for Ymail classic except that the body data was treated as HTML markup and newlines (%0D%0A) where treated as spaces. Now, nothing works. If it starts working again, it'll probably still be broken in rich text mode.

When Yahoo servers send a Location header, they *also* send data (HTML page with just a comment node in it) in the body response of the request. If you have automatic redirection turned off in Opera, it'll make it so there's no redirect link for you to click on. Either the servers need to send 0 bytes in the body, or they need to provide an HTML link on the page.

With Ymail classic, percent-encoded data representing characters like " gets converted to HTML entities, which will cause &quot; to end up in the fields.

' doesn't have to be percent-encoded in a URI. But, if you don't do it, Yahoo's servers will choke on it.

If using the new UI, if %0D%0A is present in the compose URI (like body=line1%0D%0Aline2), Yahoo's servers will sometimes choke on it.

The Yahoo servers don't accept long compose URIs like other webmails and requests will break even if the URI is mildly long.

The Yahoo servers sometimes send a Content-Length header for attacments that's different than the size of the attachment, which breaks downloading of attachments.

Yahoo insists on blocking Opera and not treating it as a first-class citizen. Its services are completely buggy and a discrace to the internet.

Because of all the bugs, the compose URI above, which is the one that should be used for Ymail no matter what UI or mode you're in, only works with Ymail classic.

Also, see Opera's browser.js for Yahoo bugs Opera's currently trying to work around.

Workarounds

If you use the new UI, it's possible to load a Ymail classic compose page that doesn't get blocked. But, you have to use a server-specific compose URI.

Try using:

URL=http://us.mg1.mail.yahoo.com/mc/compose?ymv=0&body=%m&Subj=%j&to=%t&cc=%k&bcc=%l

You can also try using the following with the new UI:

URL=http://us.mg1.mail.yahoo.com/dc/launch?sysreq=ignore&action=compose&login=1&To=%t&Subj=%j&Cc=%k&Bcc=%l&Body=%m

, which should give you support for all the fields. It will still be buggy though for all the reasons mentioned above.

Note that you should replace us.mg1 with the server that you normally get when you log in.

Operamail.com bugs

operamail.com basically has 2 bugs.

1. Its pages are not served as UTF-8 and the server-sides scripts don't support UTF-8.

2. The server uses HTML pages with a meta refresh tag for redirection. If you have automatic redirection turned off in Opera, you won't see a link to click on to continue to the next page. The redirection pages should provide a link to the next page or use an HTTP Location header with 0 bytes in the response body.

Example file

Here is an example file that covers all of the above:

Opera Preferences version 2.1 
; Do not edit this file while Opera is running 
; This file is stored in UTF-8 encoding 
; %s = full mailto URI (emitted by HTML5's registerProtocolHandler)
; Workaround keys for webmails that don't support what registerProtocolHandler emits
; %t = to 
; %j = subject 
; %m = body 
; %k = cc 
; %l = bcc 
; Write-protect this file to perhaps stop Opera from overwriting it when upgrading

[Yandex - HTML5]
ID=4
URL=http://mail.yandex.ru/compose?mailto=%s
ICON=http://img.yandex.net/i/favicon.ico

[Fastmail - HTML5]
ID=5
URL=http://www.fastmail.fm/action/compose/?mailto=%s
ICON=http://www.fastmail.fm/favicon.ico

[Opera Web Mail]
ID=6
URL=http://mymail.operamail.com/scripts/mail/Outblaze.mail?compose=1&did=1&a=1&to=%t&subject=%j&body=%m&cc=%k
ICON=http://www.opera.com/favicon.ico

[Mail.ru] 
ID=7 
URL=http://win.mail.ru/cgi-bin/sentmsg?To=%t&CC=%k&BCC=%l&Subject=%j&BodyUTF8=%m&accel=1 
ICON=http://img.imgsmail.ru/r/favicon.ico

[Ymail - Generic]
ID=8
URL=http://compose.mail.yahoo.com/?To=%t&Subj=%j&Body=%m&Cc=%k&Bcc=%l
ICON=http://mail.yahoo.com/favicon.ico

[Ymail - Classic Compose + New UI]
ID=9
URL=http://us.mg1.mail.yahoo.com/mc/compose?ymv=0&body=%m&Subj=%j&to=%t&cc=%k&bcc=%l
ICON=http://mail.yahoo.com/favicon.ico

[Ymail - New UI + Blocking Workaround]
ID=10
URL=http://us.mg1.mail.yahoo.com/dc/launch?sysreq=ignore&action=compose&login=1&To=%t&Subj=%j&Cc=%k&Bcc=%l&Body=%m
ICON=http://mail.yahoo.com/favicon.ico

[Hotmail]
ID=11
URL=http://mail.live.com/mail/EditMessageLight.aspx?n=&to=%t&cc=%k&subject=%j&body=%m&bcc=%l
ICON=http://mail.live.com/favicon.ico

[Gmail - HTML5]
ID=12
URL=https://mail.google.com/mail/?extsrc=mailto&url=%s
ICON=https://mail.google.com/favicon.ico

[Gmail]
ID=13
URL=https://mail.google.com/mail/?compose=1&view=cm&fs=1&to=%t&su=%j&body=%m&cc=%k&bcc=%l
ICON=https://mail.google.com/favicon.ico

; Change the following URIS to point to the sites the webmails are on
[SquirrelMail - Edit webmailproviders.ini]
ID=14
URL=http://your_squirrelmail_server/src/compose.php?send_to=%t&subject=%j&body=%m&send_to_cc=%k&send_to_bcc=%l
ICON=http://your_squirrelmail_server/favicon.ico
; if you want SquirrelMail 1.4x to support %s, you can add mailto_protocol_handler.php <http://shadow2531.com/sm/mailto_protocol_handler.zip> to the SquirrelMail src directory.
; and use
; URL=http://your_squirrelmail_server/src/mailto_protocol_handler.php?uri=%s

[RoundCubeMail - Edit webmailproviders.ini]
ID=15
URL=http://your_roundcubemail_server/?_task=mail&_action=compose&_to=%t&_subject=%j&_body=%m&_cc=%k&_bcc=%l
ICON=http://your_roundcubemail_server/favicon.ico

Thanks

Thanks to the Fastmail Team for specifically supporting Opera and specifically supporting what HTML5's registerProtocolHandler emits. The other webmail providers could learn a lot from these Guys and Gals.

Also thanks to the Mail.ru team for adding support for UTF-8 in their compose URI.

Contact

Although I check the comments below every once in a while, it's best to email or pm me.