The Good Life... a weblog about life, technology, and the Opera Web browser

Web Mail Integration in Opera 10.0

Screenshot of E-mail Client Selection dialogThe Opera 10.0 snapshot released today includes a new feature that allows users to click on mailto links and have them open in web mail providers, such as Gmail, Yahoo! Mail, and Windows Live Hotmail. This is particularly useful for individuals that primarily use web mail instead of a standalone e-mail client.

In a clean install, clicking a mailto link will trigger the e-mail client selection dialog, which allows users to choose between using Opera Mail, the system default mailer, or various web mail providers. When you select a web mail provider (and check the "Do not show this dialog again" checkbox), all mailto links will open in the specified web mail provider and automatically fill in parts of the compose window. For instance, the maillto link above will put "Test Mail" in the compose window subject. Users can change their settings in Preferences > Advanced > Programs by editing the "mailto" handler.

The web mail providers currently supported are Gmail, Yahoo! Mail, and Windows Live Hotmail. Yahoo! Mail and Windows Live Hotmail will not work very well if you aren't running a recent browser.js, as neither official supports Opera. Furthermore, Yahoo! Mail currently only opens the welcome page, but doesn't open a compose window.

This feature works via a list of web mail providers in the webmailproviders.ini file in the "defaults" sub-directory of the Opera program directory. On Windows, for instance, the file will be in "C:\Program Files\Opera\defaults\" if you install Opera in "C:\Program Files\Opera\". On OS X, the file is in the Opera.app package in the "Contents/Resources/defaults/" directory. Opera will need to be restarted to pick up new/changed entries in the file. Web mail providers are defined via the following format:

[Gmail]
ID=1
URL=https://mail.google.com/mail/?extsrc=mailto&url=%s
ICON=http://mail.google.com/favicon.ico
  • The provider name shown in the UI is enclosed in square brackets.
  • ID is a unique integer identifier for each entry in the file.
  • URL is the web mail provider's mailto handler URL. "%s" will be replaced with the clicked mailto URL. Currently, data and javascript URLs are allowed.
  • Icon is a link to a favicon representing the web mail provider.

Some web mail providers do not have a mailto handler URL, but can prefill compose windows by specifying each parameter separately, e.g. "http://mail.google.com/mail/?view=cm&fs=1&to=%t&su=%s&body=%m&cc=%c&bcc=%b" where %t represents the message recipient, %s the message subject, %m the message body, %c CC'd recipients, and %b BCC'd recipients. The current implementation does not natively support this style of URL, but it is possible to get around this limitation using a javascript or data URL to process the clicked mailto URL into separate parameters. For instance, the following entry could be added to webmailproviders.ini to make Opera work with Opera Web Mail (special thanks to Michael A. Puls II for providing this URL):

[Operamail.com]
ID=4
URL=javascript:(function(uri)%7B%0D%0Afunction%20decode(s)%7Btry%7Breturn%20decodeURIComponent(s).replace(%2F%5Cr%5Cn%7C%5Cr%7C%5Cn%2Fg%2C%22%5Cr%5Cn%22)%3B%7Dcatch(e)%7Breturn%20%22Opera%20percent-decode%20error%22%3B%7D%7D%0D%0Afunction%20encode(s)%7Btry%7Breturn%20encodeURIComponent(s)%3B%7Dcatch(e)%7Breturn%20%22Opera%2520percent-encode%2520error%22%3B%7D%7D%0D%0Afunction%20escapeInvalidHH(s)%7Breturn%20s.replace(%2F%25(%3F!%5B0-9A-F%5D%7B2%7D)%2Fgi%2Cfunction()%7Breturn%20%22%2525%22%3B%7D)%3B%7D%0D%0Afunction%20escapeUnsafeHH(s)%7Breturn%20s.replace(%2F%2500%7C%2501%7C%2502%7C%2503%7C%2504%7C%2505%7C%2506%7C%2507%7C%2508%7C%250B%7C%250C%7C%250E%7C%250F%7C%2510%7C%2511%7C%2512%7C%2513%7C%2514%7C%2515%7C%2516%7C%2517%7C%2518%7C%2519%7C%251A%7C%251B%7C%251C%7C%251D%7C%251E%7C%251F%2Fgi%2Cfunction(match)%7Breturn%20encode(match)%3B%7D)%3B%7D%0D%0Afunction%20filterSingleLine(s)%7Breturn%20s.replace(%2F%5Cr%7C%5Cn%2Fg%2C%22%22)%3B%7D%0D%0Afunction%20MailtoURIParser(s)%7Bthis.parse(escapeUnsafeHH(escapeInvalidHH(%22to%3D%22%2Buri.substr(7).replace(%2F%5C%3F%2F%2C%22%26%22))))%3B%7D%0D%0AMailtoURIParser.prototype%3D%7Bparse%3Afunction(dataset)%7Bthis.to%3Dthis.subject%3Dthis.body%3Dthis.cc%3Dthis.bcc%3D%22%22%3Bvar%20ref%3Dthis%3Bdataset.replace(%2F(%5B%5E%3D%26%5D%2B)%3D(%5B%5E%26%5D*)%2Fg%2Cfunction(match%2Chname%2Chvalue)%7Bhname%3Ddecode(hname).toLowerCase()%3Bif(hname%3D%3D%22to%22)%7Bif(hvalue!%3D%22%22)%7Bif(ref.to!%3D%22%22)%7Bref.to%2B%3D%22%252C%2520%22%3B%7Dref.to%2B%3Dhvalue%3B%7D%7Delse%20if(hname%3D%3D%22cc%22)%7Bif(hvalue!%3D%22%22)%7Bif(ref.cc!%3D%22%22)%7Bref.cc%2B%3D%22%252C%2520%22%3B%7Dref.cc%2B%3Dhvalue%3B%7D%7Delse%20if(hname%3D%3D%22bcc%22)%7Bif(hvalue!%3D%22%22)%7Bif(ref.bcc!%3D%22%22)%7Bref.bcc%2B%3D%22%252C%2520%22%3B%7Dref.bcc%2B%3Dhvalue%3B%7D%7Delse%20if(hname%3D%3D%22subject%22)%7Bref.subject%3Dhvalue%3B%7Delse%20if(hname%3D%3D%22body%22)%7Bif(!(hvalue%3D%3D%22%22%26%26ref.body%3D%3D%22%22))%7Bif(ref.body!%3D%22%22)%7Bref.body%2B%3D%22%250D%250A%22%3B%7Dref.body%2B%3Dhvalue%3B%7D%7D%7D)%3Bthis.to%3Dencode(filterSingleLine(decode(this.to)))%3Bthis.subject%3Dencode(filterSingleLine(decode(this.subject)))%3Bthis.body%3Dencode(decode(this.body))%3Bthis.cc%3Dencode(filterSingleLine(decode(this.cc)))%3Bthis.bcc%3Dencode(filterSingleLine(decode(this.bcc)))%3B%7D%2Cformat%3Afunction(s)%7Bvar%20ref%3Dthis%3Breturn%20s.replace(%2F(%25%25)%7C(%25T)%7C(%25S)%7C(%25M)%7C(%25C)%7C(%25B)%7C(%25w)%2Fg%2Cfunction(match%2Ca%2Cb%2Cc%2Cd%2Ce%2Cf%2Cg)%7Bif(a)return%20%22%25%22%3Bif(b)return%20ref.to%3Bif(c)return%20ref.subject%3Bif(d)return%20ref.body%3Bif(e)return%20ref.cc%3Bif(f)return%20ref.bcc%3Bif(g)return%20encode(%22mailto%3A%22%2Bref.to%2B%22%3Fsubject%3D%22%2Bref.subject%2B%22%26body%3D%22%2Bref.body%2B%22%26cc%3D%22%2Bref.cc%2B%22%26bcc%3D%22%2Bref.bcc)%3B%7D)%3B%7D%7D%3B%0D%0Aif(uri.search(%2Fmailto%3A%2Fi)!%3D0)%7Bthrow%20%22Not%20a%20MailtoURI%22%3B%7D%0D%0Avar%20parser%3Dnew%20MailtoURIParser(uri)%3B%0D%0Avar%20compose%3Dparser.format(%22http%3A%2F%2Fmymail.operamail.com%2Fscripts%2Fmail%2FOutblaze.mail%3Fcompose%3D1%26did%3D1%26a%3D1%26to%3D%25T%26subject%3D%25S%26body%3D%25M%26cc%3D%25C%26bcc%3D%25B%22)%3B%0D%0Avar%20a%3Ddocument.createElementNS(%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%2C%22a%22)%3Ba.href%3Dcompose%3Ba.click()%3B%0D%0A%7D)(%22%s%22)%3B
ICON=http://www.opera.com/favicon.ico

This feature is a work in progress and we hope to work out all of the kinks with web mail providers before the final release of Opera 10.0.

Update (2009-01-13 2:25pm ET): The initial operamail.com URL was wrong and has now been updated.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Note: Comments with a light blue background were made by the site owner.

Re: Web Mail Integration in Opera 10.0

We should consider supporting http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.htm... so that sites can add themselves to the list without users have to edit configuration files or settings.

Re: Web Mail Integration in Opera 10.0

Indeed. I believe you know who to talk to about that, since support is needed from Core. :)

Re: Web Mail Integration in Opera 10.0

To clarify, Gmail doesn't officially support Opera either. But it does work much better than the other two, IMHO :-).

Re: Web Mail Integration in Opera 10.0

Same thing for RSS feeds would be nice, if users could use their prefered web-based RSS readers.

Re: Web Mail Integration in Opera 10.0

This is just plain awesome - thanks for the information, Tim!

And I totally agree with Anne, using a custom handler seems like a reasonable idea.

Re: Web Mail Integration in Opera 10.0

Thanks for this information.Really good news.

Re: Web Mail Integration in Opera 10.0

Good info, Tim. ;) Great suggestion on self-listing, Anne. ;)

Gmail mailto works great for me in Mac build, but noticed that "Send Link by Mail" doesn't go to Gmail, but Opera Mail instead... Known issue?

Re: Web Mail Integration in Opera 10.0

Thank you for pointing that out. We have a bug report now.

Re: Web Mail Integration in Opera 10.0

Kamalesh wrote:

Gmail mailto works great for me in Mac build, but noticed that "Send Link by Mail" doesn't go to Gmail, but Opera Mail instead... Known issue?

This bookmarklet should allow you to Send Link By Mail with Gmail until the bug is fixed.

javascript:(function()%20%7B%0D%0A%20%20%20%20function%20encode(s)%20%7B%0D%0A%20%20%20%20%20%20%20%20try%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20encodeURIComponent(s.replace(%2F%5C%7C%2Fg%2C%20%22%5BYet%20to%20be%20fixed%20Opera%20bug%5D%22))%3B%0D%0A%20%20%20%20%20%20%20%20%7D%20catch%20(e)%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20%22Opera%2520percent-encode%2520error%22%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20var%20a%20%3D%20document.createElementNS(%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%2C%20%22a%22)%3B%0D%0A%20%20%20%20a.href%20%3D%20%22mailto%3A%3Fsubject%3D%22%20%2B%20encode(document.title)%20%2B%20%22%26body%3D%22%20%2B%20encode(%22%3C%22%20%2B%20document.location%20%2B%20%22%3E%22)%3B%0D%0A%20%20%20%20a.click()%3B%0D%0A%7D)()%3B

Re: Web Mail Integration in Opera 10.0

Much appreciated, Michael! I'll use it until the fix.

Re: Web Mail Integration in Opera 10.0

Sure thing, Tim; hope we can get it fixed for the next snapshot. ;)

Re: Web Mail Integration in Opera 10.0

I keep on wondering how to make the Yahoo! mail work as smoothly as it does on FF/IE. You can directly go the compose window in these two browsers for Y!Mail.

Re: Web Mail Integration in Opera 10.0

Do you mean when clicking a mailto link? Their mailto handler wasn't working very well in Opera or Firefox last time I checked, though we have contacted them about it.

Re: Web Mail Integration in Opera 10.0

I meant this url :
http://compose.mail.yahoo.com/ym/Compose?login=1&To=%s
This works fine on FF and IE but not in Opera. May be because browser.js is fiddeling with this URL.

For me, I use Yahoo! as my primary mail provider and Opera as Browser of choice. Unfortunately, these two don't work smoothly and hence browser switching. I just hope to have IMAP support from Yahoo or a better rendering of yahoo mail in Opera.

Opera Rocks!

Re: Web Mail Integration in Opera 10.0

Ahh, yes, that won't work in Opera because of redirects related to Yahoo! Mail's unsupported browser message. Try using http://us.mg2.mail.yahoo.com/dc/launch?sysreq=ignore&action=compose&To=%... instead.

Re: Web Mail Integration in Opera 10.0

Oops. Please see my comment below

Re: Web Mail Integration in Opera 10.0

Great! So how about extending it. 'To' field works fine but the subject and body have no effect in Opera.
http://us.mg0.mail.yahoo.com/dc/launch?action=compose&To=bogus@email.com....
will work fine on FF but will provide value only for 'To' field in Opera.

It seems that JavaScript is used to grab the URL parameters and launch the compose window with default values. It would be interesting if Opera can make that piece of code work (browser.js?).

Re: Web Mail Integration in Opera 10.0

Last time I checked, Yahoo! Mail was broken in both Opera and Firefox. See https://bugzilla.mozilla.org/show_bug.cgi?id=426260#c22, for instance. Once it's working correctly Firefox, we'll try to find the right way to get it working in Opera, too, though it may be up to Yahoo! to stop blocking Opera.

Re: Web Mail Integration in Opera 10.0

Hello Anshul, the following should be helpful:

The new Yahoo mail supports very few browsers and browser versions. For browsers that it doesn't support, it redirects you to "/dc/system_requirements?browser=blocked". When this happens, all the compose data in "http://compose.mail.yahoo.com/?To=" gets dropped by the *server*.

In other words, the new Yahoo mail doesn't support Opera at all and actively blocks it. However, Opera's browser.js allows you to get in because *after* Yahoo redirects you to "/dc/system_requirements?browser=blocked", browser.js will redirect you to "/dc/launch?sysreq=ignore" to bypass the browser check. But, as you can see, the server already removed the compose data before browser.js even had a chance to workaround anything.

Further, Yahoo doesn't support "http://compose.mail.yahoo.com/?url=", which is required by Firefox and Opera to support filling in all the fields. Yahoo does support "http://compose.mail.yahoo.com/?To=&Subj=&Cc=&Bcc=&Body=" to fill in the rest of the fields, but that's not in a format that Firefox and Opera emit (Yahoo needs to support a URI emitted by Firefox/HTML5's registerProtocolHandler). Further, it wouldn't matter for Opera anyway as the server still drops the compose data on you for blocked browsers.

Now, even if you were to emit a URI like "http://compose.mail.yahoo.com/?To=&Subj=&Cc=&Bcc=&Body=" in Firefox, the new Yahoo mail still wouldn't work right for all the fields because the new Yahoo mail has bugs where it ignores the Cc, Subj, Body and Bcc values. Further, the Yahoo server chokes on ' and it has trouble with some characters in the field values (Like quotes: it will convert them to HTML entities, which is another Yahoo bug).

Now, in Opera, you can bypass the "blocked" part with a URI like "http://us.mg1.mail.yahoo.com/dc/launch?sysreq=ignore&action=compose&login=1&To=&Subj=&Cc=&Bcc=&Body=". But, again, that's not a URI that supports what Firefox's registerProtcolHandler emits. Instead, you're forced to put the whole mailto URI in the To= part and have Yahoo strip the 'mailto:' off of it and use just the To address part of the mailto URI that's passed in. But, even if you were to use Subj= and Cc= etc., it still wouldn't work right because the new Yahoo mail has bugs that ignore them.

Now, Yahoo Mail Classic supports Opera. But, Yahoo Mail Classic has bugs parsing the compose data and bugs parsing the compose data in HTML composition mode. However, if you use Yahoo Mail Classic and compose in plain text mode, you can use the following URI to workaround the Yahoo server bugs.


"http://shadow2531.com/opera/testcases/registerProtocolHandler/yahoo_mail.html?uri=%s"

(without the quotes)

Yahoo Mail Classic in plain text composition mode and that URI is about as good as it gets. The Yahoo server scripts are so buggy it's ridiculous. And, it doesn't help that Yahoo actively blocks Opera.

Point being, I'm sure Opera will try to workaround what Yahoo bugs it can, but Yahoo is such a mess that there are just some things Yahoo has to fix on their end.

Finally, if you want to get the To field in the new Yahoo mail to work (except for the entity problem mentioned earlier), you can try:


"http://shadow2531.com/opera/testcases/registerProtocolHandler/yahoo_mail.html?uri=%s&newui=true"

(without the quotes)

Just note that these experimental workaround webmailprovider URIs may break if Yahoo changes something again and the newui=true workaround uses a U.S server (which may not work for other countries or your account). And, if you switch between Yahoo Mail Classic and the new Yahoo Mail or vice versa, make sure to clear all your Yahoo cookies or the Yahoo servers can get confused.

Hope that helps

Re: Web Mail Integration in Opera 10.0

BTW, since the Yahoo Mail Classic compose page works better than the new UI compose page, here's a webmailprovider URI you can use to always load the classic compose page whether you're using the new UI or not (it avoids the browser blocking too):

"http://shadow2531.com/opera/testcases/registerProtocolHandler/yahoo_mail.html?uri=%s&generic=true"

(without the quotes)

Re: Web Mail Integration in Opera 10.0

Thanks Michael!

This direct link for classic mail compose is cool. Except Yahoo failed it again.
1. Body text is not recognized
2. (minor but annoying and dangerous) Pressing enter while using their email ID autocomplete will just send the mail immediately.

Its bad!

Frankly, I don't have FF installed, instead I use Flock for all this testing which is built upon FF. It has a feature to select Yahoo as your default webmail provider and then Flock will handle all the mailto URIs. In Flock, all the test links on following page gives desired result.
http://www.scottseverance.us/mailto.html
I hope this can help Opera Team find ways to get it work.

Yahoo! *claims* their new UI to be FULLY compatible with FF,IE,Safari leaving only Opera. Safari's worldwide share might be close to that of Opera but some internal developers might carry a Mac and hence the disparity.

Yahoo uses their YUI library which is buggy when it comes to Opera. I dropped using that just because of this. And all Yahoo products which make use of that library will remain buggy. Root of all evil.

Re: Web Mail Integration in Opera 10.0

Flock just uses "http://us.mg1.mail.yahoo.com/dc/launch?action=compose&To=&Cc=&Subj=&Body=". But, Yahoo won't let Opera use that without adding the sysreq=ignore to it. But, when you do that, it makes Yahoo ignore Subj, Body and Cc, which you can even see happening in Flock.

Re: Web Mail Integration in Opera 10.0

Tested and verified. Its indeed the case. I don't expect Yahoo! to take on the issues anytime soon. For past few years, It has become a company with great ideas but not so great implementations.

sending/checking email is one of the most important online activities and its frustrating not being able to do it properly in your fav browser.

Waiting for a day to a bug free Yahoo mail OR a day when I will be frustrated enough to take pain of moving my existing mails to GMail for a complete switch and be happy with the supercool IMAP.

Re: Web Mail Integration in Opera 10.0

Yeh, beyond the sysreq=ignore problem, there may still be some other problems hiding though.

As for Gmail, it indeed is much much better in this area (it only has 1 tiny bug that's already known by the Gmail team). Luckily, I've gotten a lot of Yahoo users to switch to it because of things like this. Of course, switching is a big deal, which is understandable.

Although fastmail isn't that great of a webmail, its support in this area is virtually perfect with "https://www.fastmail.fm/mail/?MSignal=MC-FN**%s". (This is because they specifically added support for HTML5's registerProtocolHandler URIs)

Re: Web Mail Integration in Opera 10.0

Could you please consider adding support for Google Apps for hosted domains (ie. https://mail.google.com/a/mariotomic.com/) where user could define what domain is hosted with Google Apps.

Currently, as we see, there is a way to do this, but it requires editing files that get replaced every time we upgrade Opera (those located inside .app file/folder). I guess that having copied webmailproviders.ini in ~/Library/Preferences/Opera Preferences/defaults and then edited it will work, but again, having an option to just type opur domain at Google apps would be a great success :)

Re: Web Mail Integration in Opera 10.0

We're evaluating various ways for users to add webmail providers not on the default list, though I'm not sure such a feature will be available in Opera 10.0.

Re: Web Mail Integration in Opera 10.0

Thanks for a prompt reply :)
Well, there is always user customization as a last resort :)

Re: Web Mail Integration in Opera 10.0

I was able to get thunderbird to work with google apps and IMAP accounts, they have updated the imap settings documentation at google.
http://mail.google.com/support/bin/answer.py?answer=77662

My problem is that for google apps to work with thunderbird, I have to have the incoming IMAP use ssl and port 993. Opera mail only seems to allow TLS.

Re: Web Mail Integration in Opera 10.0

Just change the port in Opera Mail's account settings dialog to 993 and you should be all set.

Re: Web Mail Integration in Opera 10.0

Got it working

I am fairly sure I tried just changing the port to 993, and it failed. After reading the earlier comment about not working with googleapps I stopped trying to mess with the settings.

The way I got it working was by setting up a new account in operamail that connects to a regular gmail account of mine. Opera automatically sets up everything for gmail.
Then I opened the server settings for that account, and just edited the relevant values to change x@gmail.com to y@mydomain.com