Mailto Link That Opens Gmail Compose (Not Outlook or Mail)

Standard mailto links open whatever email app the user has set as default — usually Outlook on Windows, Mail on Mac. If you want a button that always opens Gmail compose, use Gmail’s compose URL directly. Here’s the format and the user-side setup that makes it stick.

The Gmail compose URL

https://mail.google.com/mail/?view=cm&fs=1&to=hello@example.com&su=Subject&body=Body%20text&cc=cc@example.com&bcc=bcc@example.com

Parameters:

ParameterPurpose
view=cmRequired. “Compose mode.”
fs=1Optional. Full-screen compose.
toRecipient email.
suSubject (Gmail uses su, not subject).
bodyMessage body.
cc / bccCarbon copies.

HTML button example

<a
  href="https://mail.google.com/mail/?view=cm&fs=1&to=hello@example.com&su=Hello"
  target="_blank"
  rel="noopener">
  Email me on Gmail
</a>

target="_blank" opens Gmail in a new tab so the user doesn’t lose your page.

The mailto vs Gmail-compose tradeoff

mailto:Gmail compose URL
Opens user’s default email appYesNo, only Gmail
Works for users without GmailYesNo (lands on login)
Universal recommendationYesFor Gmail-heavy audiences
Mobile behaviorOpens default mail appTries to open Gmail app

Default to mailto links for general public sites. Use the Gmail compose URL only when you know your audience is on Gmail (B2B SaaS, dev tools, agency clients).

Best of both: dual-link option

Show both:

<a href="mailto:hello@example.com?subject=Hello">Email</a>
|
<a href="https://mail.google.com/mail/?view=cm&fs=1&to=hello@example.com&su=Hello" target="_blank" rel="noopener">Open in Gmail</a>

Lets the user choose. Cleaner for power users.

Forcing browser to use Gmail for all mailto links

Users can set Gmail as their default mailto handler in Chrome:

  1. Open Gmail.
  2. Click the diamond/handler icon in Chrome’s URL bar (right side).
  3. Allow Gmail to handle mailto links.

From then on, every mailto link they click opens Gmail. You can’t force this server-side — it’s a user setting. But a one-line tip (“Set Gmail as your default email handler”) next to your mailto button helps Gmail-using readers.

Mobile behavior

  • iOS: Gmail compose URL opens Gmail app if installed; otherwise opens Gmail web in Safari.
  • Android: Same — Gmail app first, web fallback.
  • Mac: Opens in default browser, then redirects to Gmail.
  • Windows: Same as Mac.

Outlook compose URL (for comparison)

Outlook has its own version:

https://outlook.live.com/mail/0/deeplink/compose?to=hello@example.com&subject=Hello&body=Hi

Or for Outlook 365 work accounts:

https://outlook.office.com/mail/deeplink/compose?to=hello@example.com&subject=Hello

Same idea — direct compose URL bypasses the default mail handler.

What about Apple Mail?

No web compose URL exists. Apple Mail only opens via the standard mailto: link. Mac users with Apple Mail as default get it automatically from mailto:.

Common mistakes

  • Using subject= instead of su= in Gmail URL. Gmail ignores subject; uses su.
  • Forgetting view=cm. Without it, Gmail just opens to the inbox.
  • No target="_blank". User loses your page when Gmail opens.
  • Hardcoding Gmail URL for all users. Yahoo/Outlook users land on a Gmail login page, get confused.
  • Long body texts. URL length limits at ~2000 characters in some browsers.

URL encoding cheat sheet

CharacterEncoded
Space%20
Line break%0A
Comma%2C
Ampersand (in body)%26

FAQ

Will the Gmail link work if the user is logged out?

It bounces them to the Gmail login page. After login, the compose window opens with your prefilled fields.

Can I include attachments?

No. Neither mailto nor Gmail compose URLs support attachments. The user has to attach manually.

Does this work in incognito mode?

Yes, but the user has to log into Gmail first.

Is there a Yahoo Mail compose URL?

Yes: https://compose.mail.yahoo.com/?to=hello@example.com&subject=Hi&body=Body

Should I detect the user’s email provider and pick the URL?

You can’t reliably detect from a browser. Best to offer mailto by default and a “Open in Gmail” fallback.

Build standard mailto links in seconds

The mailto link generator outputs proper mailto URLs with subject, body, CC, and BCC encoded correctly. Use it for public buttons; layer the Gmail-compose URL only when needed.