Gmail for iOS URL Scheme

Gmail for iOS URL Scheme

Tom Scogland figured out the complete URL scheme for Gmail 2.0, Google's official Gmail app for the iPhone and iPad. As documented on his blog, the Gmail app allows you to compose an entire message using the following template:

googlegmail:///co?subject=<subject text>&body=<body text>

As I've also found out, you can add a to= parameter to pass a URL-encoded email address to which an email will be sent to. Unfortunately, my tests also confirmed that a similar from= parameter isn't supported, and that this undocumented URL scheme doesn't support x-callback-url, unlike Chrome. So, it's not possible to return to a "calling" app after an email has been sent or the compose screen dismissed. I've also noticed how this URL scheme isn't particularly reliable at bringing up the compose screen if the app wasn't paused in the background (such as in a cold start); this is probably the reason Google isn't publicizing this URL scheme -- it's not ready yet.

I've still made some stuff for it, though. Here's a JavaScript bookmarklet that will open Gmail using a webpage's title as Subject and URL as body:

javascript:window.location='googlegmail:///co?subject='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(location.href);

Here's an action for Launch Center Pro:

googlegmail:///co?subject=[prompt]&body=[prompt]

And an action for Drafts:

googlegmail:///co?subject=[[title]]&body=[[body]]

Keep in mind that the URL scheme may fail if Gmail wasn't paused in the background (it'll show a splash screen when loading again). I'm looking forward to improvements to the URL scheme, as Google has been doing a great job with these lately.

Source: tom.scogland.com