Fact-checked by Grok 2 weeks ago

mailto

The mailto URI scheme is a standard protocol defined by the (IETF) for creating () that identify resources accessible via Internet mail, primarily enabling hyperlinks to open a user's default with a pre-filled including the recipient's and optional elements like or text. Originally introduced in 1738 in 1994 as part of the initial URI specifications, the mailto scheme was revised in 2368 in 1998 to expand support for email headers beyond just the address, and further updated in 6068 in 2010 to enhance compatibility with Internationalized Resource Identifiers () and encoding for non-ASCII characters. This evolution ensures broader while maintaining backward compatibility, though it does not fully address email address internationalization as covered in separate standards like 4952. In its basic form, a mailto URI consists of the prefix "mailto:" followed by an (e.g., mailto:[email protected]), with optional query parameters after a "?" to specify headers such as subject, cc, bcc, or body, where multiple parameters are joined by "&" and values are percent-encoded for special characters. For instance, mailto:[email protected]?subject=Hello&body=Message prepares an email draft addressed to the recipient with the given and . Commonly employed in , mailto URIs are integrated into <a> elements to create clickable links that trigger composition directly from browsers, without requiring server-side processing, though success depends on the user's configured application and may expose addresses to risks if overused. Key supported headers include to for the primary recipient, cc and bcc for additional addresses, subject for the message title, and body for initial content, but arbitrary headers are permitted as long as they conform to mail standards. Limitations include no guarantee of delivery, potential security concerns like via malicious links, and variable client support for complex parameters.

Overview

Definition

The mailto URI scheme is a standardized (URI) scheme defined in accordance with the generic syntax of 3986, specifically designed to identify resources associated with mail addresses and to facilitate the composition of new messages within mail user agents (MUAs). As outlined in 6068, a mailto URI primarily specifies one or more email addresses as recipients, optionally including additional message components such as subject lines, recipients, and body text, which are passed to the user's preferred to pre-populate a new outgoing message. In operation, a mailto URI serves as a mechanism to trigger actions in email software, such as launching an MUA and initiating message composition, rather than retrieving or accessing pre-existing content from a remote . This distinguishes it from other URI schemes like http or ftp, which are oriented toward fetching and interacting with resources over networks, whereas mailto focuses on local email generation without implying data retrieval from an external source. A fundamental aspect of the mailto scheme is its role in enabling the creation of new messages exclusively, without providing means to access or retrieve archived or existing correspondence. This scheme originated in the early specifications for uniform resource locators, as initially described in RFC 1738.

Purpose and applications

The mailto URI scheme serves primarily to designate an mailing , enabling the creation of hyperlinks or commands that launch a user's default with a pre-populated , including the recipient's and optional elements such as subject, body text, and additional headers. This allows for direct initiation of email composition without requiring the user to manually enter details, facilitating seamless transitions from digital documents or interfaces to email interactions. In web development, mailto URIs are commonly integrated into hyperlinks on websites, such as "contact us" buttons or email icons, to provide a straightforward method for visitors to send inquiries directly from the page, bypassing the need for server-side form processing and reducing website maintenance overhead. For instance, a simple link can pre-fill the recipient field with a support email address, streamlining user outreach for e-commerce sites, blogs, or informational pages. Beyond the web, desktop applications leverage mailto by registering as protocol handlers in operating systems, allowing quick emailing features within productivity software or browsers, where clicking a mailto link automatically opens the configured email application with the specified details. The scheme's applications extend to programmatic contexts, such as automated requests in management, where mailto URIs can trigger subscription or unsubscription actions by pre-filling the message body with commands, enhancing user without custom backend implementations. Additionally, it supports in various applications and protocols for email-related workflows. Overall, mailto simplifies user interactions by bridging and email ecosystems , promoting and efficiency while avoiding dependencies on external servers or complex APIs.

History

Initial definition

The mailto URL scheme was first formally introduced in December 1994 as part of the specifications for Uniform Resource Locators () in RFC 1738, which outlined a framework for identifying and accessing resources on the . This scheme was one of several early URI schemes designed to standardize the notation for various Internet resources, enabling consistent referencing across protocols and applications. Developed during the rapid expansion of the in the mid-1990s, the mailto scheme aimed to facilitate the creation of hyperlinks in documents that could directly invoke email composition by specifying recipient addresses. At the time, the web's growth necessitated simple mechanisms for integrating functionality, allowing users to click on a link to open their default mail client with a pre-filled recipient field, thereby bridging hypertext navigation with electronic mail systems. The initial version of the mailto scheme was highly limited, supporting only the designation of an mailing address without any additional parameters, headers, or body content. Specifically, its syntax was defined as mailto:<[rfc](/page/RFC)822-addr-spec>, where the address followed the encoded format from 822, and no reserved characters or further information could be implied or included. Unlike other schemes, mailto did not point to a retrievable data object but rather served as a trigger for mail user agent actions. This basic design was later expanded in subsequent RFCs to accommodate more complex email interactions.

Subsequent updates

In July 1998, RFC 2368 extended the mailto URL scheme to support the inclusion of message headers, such as subject, cc, bcc, and body content, thereby updating and superseding aspects of the earlier specifications in RFC 1738 and RFC 1808. This update enabled more structured email composition triggers while maintaining compatibility with basic address designation. Subsequently, in October 2010, RFC 6068 obsoleted RFC 2368 and refined the mailto URI scheme to align with the generic URI syntax in RFC 3986. Key refinements included support for Internationalized Resource Identifiers (IRIs) to handle non-ASCII characters, clarified rules for percent-encoding of parameters, and the deprecation of the body parameter's quoted-printable encoding in favor of direct URI encoding. No major updates to the mailto scheme have occurred since RFC 6068, which established it as a stable Proposed Standard within the Internet Engineering Task Force (IETF) framework.

Syntax

URI format

The mailto URI scheme follows the generic syntax defined in RFC 3986 for Uniform Resource Identifiers (URIs), where a URI consists of a scheme followed by a hierarchical part, optional query, and optional fragment, expressed as scheme ":" hier-part [ "?" query ] [ "#" fragment ]. For mailto, the scheme is fixed as "mailto:", and the hierarchical part is rootless or empty, placing the primary email address(es) directly in the path component without an authority prefix like "//". The overall form is thus mailto:local-part@domain (or multiple comma-separated addresses), adhering to the addr-spec from RFC 5322 for the local-part and domain. In the generic URI syntax, an optional component—preceded by "//" and potentially including userinfo (e.g., username:password@), , and —may appear after the , but this is not used in mailto URIs; the instead forms the , treating the as non-hierarchical and opaque beyond the initial delimiter. The userinfo subcomponent of , when present in other schemes, is deprecated due to risks such as inadvertent exposure of credentials. For mailto, the component holds one or more addr-spec values (e.g., local-part@[domain](/page/Domain)), optionally followed by a query component starting with "?" to include additional parameters as key-value pairs separated by "&". Encoding in mailto URIs requires for reserved characters (such as /, ?, #, &, ;, =, and space as %20) to prevent delimiter conflicts, using the standard %HH form from RFC 3986. Non-ASCII characters, including those in internationalized email addresses, are first converted to byte sequences and then percent-encoded (e.g., "café" becomes caf%C3%A9). This ensures compatibility with the scheme's syntax while supporting global address formats per RFC 5322. The query component extends this structure for header-like parameters, but its details are scheme-specific.

Supported headers

The mailto URI scheme supports a limited set of standard email headers as query parameters to pre-populate fields when a client application, such as an program, processes the . These headers are appended to the URI after a (?), with multiple parameters separated by ampersands (&), in the format ?header=value&header2=value. For instance, mailto:[email protected]?subject=Test&[email protected] specifies a and carbon copy recipient. All header values must conform to the syntax rules in 5322 for email addresses and header fields, with reserved characters percent-encoded (e.g., spaces as %20, line breaks in body as %0D%0A). The primary recipient is implied by the path component of the (an or comma-separated list thereof), but additional recipients can be specified via the to header for clarity or multiple addresses. The to header value follows 5322's <addr-spec> format, allowing multiple addresses separated by commas (e.g., [email protected],[email protected]). The header provides a subject line for the message, encoded as a case-sensitive value without additional structure. The cc header adds recipients in the same format as to, listing secondary addresses visible to all parties. Similarly, the bcc header specifies recipients, also in <addr-spec> format, though their inclusion in the URI makes them visible to anyone inspecting it. The body header contains the message body as only, intended for the first text/plain part of the ; it supports no , multipart types, or other encodings beyond and . Line breaks must be explicitly encoded as %0D%0A to ensure compatibility, and while 5322 limits individual header lines to 998 characters (including folding), the URI's practical length constraints apply to the entire body value. Optionally, the in-reply-to header can reference a for threading purposes, using a value like %3C3469A91.D10AF4C%40example.com%3E (percent-encoded). The references header similarly links to one or more prior s, comma-separated and encoded, though both are infrequently implemented in modern clients. Duplicate headers are not recommended, as handling varies across implementations (e.g., using the first occurrence or concatenating values).

Usage

In web documents

In HTML documents, the mailto URI scheme is utilized as the value for the href attribute within <a> elements to establish hyperlinks that facilitate email communication. For instance, an anchor tag configured as <a href="mailto:[email protected]">Send Email</a> enables users to initiate an email draft upon activation. This integration is defined in the HTML specification, where mailto is recognized as a valid URL scheme for hyperlinks. When a user activates a mailto link in a web browser, the browser typically invokes the operating system's default mail agent (MUA), such as Microsoft Outlook or Mozilla Thunderbird on desktop systems, pre-populating the recipient field and any specified headers like subject or body. On mobile devices, this action commonly launches the native application, such as the Mail app on iOS or Gmail on Android, depending on user-configured defaults. If no local MUA is available, certain browsers like Google Chrome may redirect to a configured webmail service, such as Gmail, to handle the request. For accessibility compliance, links require descriptive link text that conveys the purpose, such as "Contact support" instead of merely displaying the , to ensure screen readers announce the action clearly to users with visual impairments. Additional attributes, like aria-label, can enhance this by providing supplementary descriptions when the visible text alone is ambiguous, aligning with WCAG guidelines for perceivable and operable content. considerations include ensuring touch-friendly link sizes, as seamlessly transitions to the device's interface without disrupting the experience. Modern browsers impose limitations on mailto links for , preventing from directly intercepting or automating their activation without explicit user gestures to mitigate potential abuse, such as unsolicited launches. Consequently, in scenarios where a default MUA may not be present—particularly on shared or restricted devices—implementing fallback mechanisms like server-side forms is recommended to guarantee consistent functionality and user control.

In applications and protocols

The mailto URI scheme extends beyond web contexts into desktop applications, where it serves as a mechanism for embedding interactive links within documents and interfaces. In applications like PDF viewers, such as , users can create using the mailto scheme to enable direct initiation of compositions from within PDF files; for instance, selecting text and linking it to a mailto prompts the default mail (MUA) upon clicking, facilitating contact forms or support requests embedded in documents. Similarly, word processors like support inserting mailto via the Insert dialog, allowing users to associate selected text or objects with an , , and body parameters, which opens the system's default when activated. This integration enhances document interactivity without requiring external scripting, relying on the application's handling capabilities to delegate to the OS-level MUA. In communication protocols, mailto integrates with systems like XMPP to provide auxiliary contact mechanisms, particularly for service discovery and user addressing. Within the Extensible Messaging and Presence Protocol (XMPP), as defined in extensions like XEP-0157, mailto URIs are used in responses to advertise contact points for XMPP entities, such as abuse reporting or administrative support; for example, a server might return <mailto:[email protected]> alongside XMPP addresses to enable -based interaction with chat services. This supports hybrid communication scenarios, including gateways that bridge XMPP chats to for interoperability. These uses leverage mailto's standardized format to complement protocol-specific addressing, fostering unified user directories across messaging platforms. Programming languages incorporate mailto support through that invoke the system's default MUA, simplifying email initiation in applications. In , the java.awt.[Desktop](/page/Desktop) class provides the mail(URI) method, which constructs a mailto URI and launches the associated ; for example, Desktop.getDesktop().mail(URI.create("mailto:[email protected]?subject=Hello")) populates the recipient and subject fields directly. Python's webbrowser module offers a similar high-level via webbrowser.open('mailto:[email protected]'), which delegates to the OS to open the default browser or handler for the , effectively starting an email draft without low-level library dependencies. These abstract handling, ensuring cross-application compatibility while adhering to the underlying protocol's parameters like , BCC, and body content. Cross-platform handling of mailto occurs at the operating system level through URI scheme registration, enabling seamless delegation to default applications regardless of the invoking software. On Windows, the registry stores protocol associations under keys like HKEY_CLASSES_ROOT\mailto\shell\open\command, where applications register as handlers to process mailto invocations, allowing the system to launch the configured MUA such as Outlook upon encountering the URI. On macOS, Launch Services manages these associations via the application's Info.plist file, using keys like CFBundleURLTypes to declare support for the mailto scheme, after which the system queries and activates the appropriate handler through the Launch Services database for consistent behavior across apps. This OS-level abstraction ensures that mailto functions uniformly in diverse environments, from native apps to scripted invocations, by centralizing scheme resolution.

Examples

Basic examples

The mailto URI scheme enables the creation of hyperlinks that, when activated, launch the user's default to compose a . In its simplest form, a mailto specifies a single recipient's , prompting the client to open a new addressed to that individual. For example, the URI mailto:[email protected] directs the to prepare a to [email protected] with no additional fields pre-filled. To include a predefined subject line, the URI appends a query using the subject header. This allows the email client to automatically populate the field upon opening. A basic instance is mailto:infobot@[example.com](/page/Example.com)?subject=current-issue, where the "current-issue" is set for the message to infobot@[example.com](/page/Example.com). For addressing multiple recipients in the primary "To" field, email addresses are separated by commas within the URI's component. This results in all specified addresses being listed as direct recipients. An example is mailto:joe@[example.com](/page/Example.com),bob@[example.com](/page/Example.com), which opens an with both joe@[example.com](/page/Example.com) and bob@[example.com](/page/Example.com) in the "To" field. Handling international or non-ASCII characters requires percent-encoding to ensure compatibility across systems, as per URI encoding rules. For instance, an email address containing accented characters, such as café@example.com, must be encoded as mailto:caf%C3%[email protected], where é is represented by its UTF-8 bytes in hexadecimal form (%C3%A9). This prevents parsing errors in email clients.

Advanced examples

Advanced mailto URIs can incorporate multiple headers to pre-populate email fields such as carbon copy (cc), subject, and body, enabling more complete message preparation. For instance, the URI mailto:[email protected][email protected]&subject=Hello&body=Hi specifies the primary recipient, adds a cc recipient, sets the subject line, and includes a brief body text, allowing the user's email client to launch with these details filled in. This multi-header approach is defined in the mailto URI specification, which permits headers to be chained using ampersands after the initial question mark. To handle multiline content in the , special encoding is required for line breaks, as the must remain a single, valid string. The sequence %0D%0A represents a followed by a line feed (CRLF), the standard for line endings. An example is mailto:[email protected]?body=send%20current-issue%0D%0Asend%20index, where the instructs an automated service to send two items across lines. This encoding ensures compatibility with URI syntax rules while preserving the intended message structure. For threading, the in-reply-to header can reference an existing identifier, facilitating conversation continuity. The URI mailto:[email protected]?In-Reply-To=%3C3469A91.D10AF4C%40example.com%3E sets the reply header to a specific (encoded with percent signs for angle brackets), which clients use to link the new to the . This feature supports standard protocols for maintaining discussion context. A common edge case arises with overly long body content, where the URI exceeds practical limits for header fields. Email standards recommend that no header line surpass 998 characters to ensure reliable transmission across systems. If a mailto URI's body parameter generates a line longer than this threshold—such as a verbose, unencoded message—it may be truncated by the email client or mail server, potentially corrupting the intended content. Implementers must therefore encode and constrain body text to avoid such issues.

Security and privacy

Risks and vulnerabilities

One significant risk associated with mailto URIs is the exposure of email addresses when they are embedded in publicly accessible web pages or documents, allowing automated bots to harvest them for distribution. This arises because the URI directly includes the recipient's address in within the HTML source code, which web crawlers can easily parse and extract. Additionally, browser histories or logs from network intermediaries (e.g., proxies) that record interactions with these URIs may inadvertently store email addresses, further increasing the potential for unauthorized access and misuse in targeted or campaigns. Security vulnerabilities in mailto URIs stem from their integration with clients, where poorly implemented handlers in mail user agents (MUAs) can enable remote execution or other exploits. For instance, certain desktop clients, such as older versions of , have been susceptible to attacks triggered by specially crafted mailto links that exploit inadequate parameter validation, potentially leading to without user interaction beyond clicking the link. More recent examples include shell command injections and injections in 28.1 through 28.2 via crafted mailto URIs (CVE-2023-27985 and CVE-2023-27986). Malicious URIs can also facilitate by incorporating deceptive elements like falsified lines or that prompt users to disclose sensitive information upon composing the , as seen in scams exploiting mailto links on platforms like in 2025. In web contexts, these links serve as an when embedded in untrusted sites, exploiting MUA weaknesses to initiate unauthorized file attachments or other actions. Header injection represents another critical vulnerability, occurring when unescaped user inputs are incorporated into mailto URI parameters, enabling attackers to append or modify email headers. For example, an attacker could manipulate a URI like mailto:[email protected]?subject=Hello by injecting %0D%0ACC:[email protected], thereby adding unauthorized recipients to the message without the sender's knowledge. This can result in unintended disclosure of message content to third parties or facilitate spam relay through the victim's account. Such injections exploit the lack of strict validation in URI construction, particularly in dynamic web applications. Although the mailto scheme's syntax does not support a userinfo component (e.g., username:password@), malformed URIs attempting to include it in legacy or non-compliant implementations may still process it insecurely, posing risks of leakage. This aligns with the broader of userinfo with credentials in URIs under RFC 3986 to prevent of information in , which could otherwise be intercepted or harvested.

Mitigation strategies

To mitigate privacy risks from mailto URIs, such as by bots that can lead to unwanted , web developers should prefer server-side contact forms over direct mailto links, as these forms process messages without exposing the recipient's address in code. Contact forms can incorporate or other bot-detection mechanisms to further reduce abuse. When mailto links must be used, obfuscation methods like JavaScript-based encoding or Cloudflare's Email Address Obfuscation feature can dynamically construct the at , rendering the invisible to simple scrapers while remaining functional for human users. These techniques split the address into parts (e.g., using atob for decoding) or rotate characters to evade pattern-matching bots. For security in applications generating mailto URIs dynamically, strict input validation and sanitization of (e.g., , , ) are critical to prevent injection attacks, such as SMTP command injection or . The Input Validation Cheat Sheet recommends allowlist-based approaches, including regular expressions to enforce RFC 5321-compliant formats (e.g., limiting local parts to 63 characters and restricting dangerous characters like backticks or null bytes), applied early in the data flow. Additionally, avoid populating the parameter with untrusted user input, as it could introduce malicious payloads into the composed message. Mail user agents (MUAs) and browsers should be configured to always prompt users for before opening an or sending a from a mailto link, disclosing the full intended headers and body to allow review and prevent unauthorized actions. For sites deemed untrusted, integrating fallbacks (e.g., via links to services like ) ensures users can choose secure composition methods without relying on local clients. To maintain standards compliance and avoid compatibility issues or vulnerabilities, mailto URIs must follow RFC 6068 encoding rules, non-ASCII and reserved characters (e.g., spaces as %20, question marks as %3F) in , while eschewing deprecated elements like the userinfo component, which is incompatible with the scheme's syntax. Limiting headers to safe fields (e.g., To, , ) and avoiding duplicates further ensures across clients.

References

  1. [1]
    RFC 6068: The 'mailto' URI Scheme
    This document defines the format of Uniform Resource Identifiers (URIs) to identify resources that are reached using Internet mail.
  2. [2]
    RFC 2368: The mailto URL scheme
    The mailto URL scheme is used to designate the Internet mailing address of an individual or service. In its simplest form, a mailto URL contains an Internet ...Missing: web | Show results with:web
  3. [3]
    RFC 6068 - The 'mailto' URI Scheme - IETF Datatracker
    This document defines the format of Uniform Resource Identifiers (URIs) to identify resources that are reached using Internet mail.
  4. [4]
    <a>: The Anchor element - HTML | MDN
    Aug 13, 2025 · To create links that open in the user's email program to let them send a new message, use the mailto: scheme: html. Copy Play. <a href="mailto ...Abbr · : The Ordered List element · Javascript: URLs · Attribution-Reporting-Eligible
  5. [5]
    RFC 1738: Uniform Resource Locators (URL)
    This document specifies a Uniform Resource Locator (URL), the syntax and semantics of formalized information for location and access of resources via the ...
  6. [6]
    RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax
    This specification defines the generic URI syntax and a process for resolving URI references that might be in relative form, along with guidelines and security ...
  7. [7]
  8. [8]
  9. [9]
  10. [10]
  11. [11]
  12. [12]
    Change the program used to open email links | Firefox Help
    Dec 11, 2023 · Learn how to change the email program that Firefox opens when you click a “mailto” link, or use the “Email Link” and “Email Image” features.
  13. [13]
    Technique ARIA8: Using aria-label for link purpose - W3C
    The aria-label attribute provides a way to place a descriptive text label on an object, such as a link, when there are no elements visible on the page that ...
  14. [14]
    Event: preventDefault() method - Web APIs | MDN
    Sep 18, 2025 · You can use Event.cancelable to check if the event is cancelable. Calling preventDefault() for a non-cancelable event has no effect.Missing: mailto | Show results with:mailto
  15. [15]
    How to add a hyperlink to PDF | Adobe Acrobat
    How to add hyperlinks to a PDF. · 1. Choose Tools › Edit PDF › Link › Add or Edit. · 2. Drag a rectangle where you want to create a link. · 3. In the Create Link ...
  16. [16]
    Create or edit a hyperlink - Microsoft Support
    The simplest way to create a hyperlink in a Microsoft 365 document is to press ENTER or the SPACEBAR immediately after typing a webpage address.
  17. [17]
    XEP-0157: Contact Addresses for XMPP Services
    ### Summary: Use of mailto in XMPP for Contact Addresses or Bridging
  18. [18]
    RFC 3261: SIP: Session Initiation Protocol
    SIP is an application-layer control protocol for creating, modifying, and terminating sessions, including telephone calls and multimedia conferences.
  19. [19]
    Desktop (Java Platform SE 8 ) - Oracle Help Center
    Launches the mail composing window of the user default mail client, filling the message fields specified by a mailto: URI. A mailto: URI can specify message ...
  20. [20]
    webbrowser — Convenient web-browser controller — Python 3.14.0 ...
    The webbrowser module provides a high-level interface to allow displaying web-based documents to users. Under most circumstances, simply calling the open() ...
  21. [21]
    Launch the default Windows app for a URI - Microsoft Learn
    Sep 17, 2025 · URIs allow you to launch another app to perform a specific task. This topic also provides an overview of the many URI schemes built into Windows ...Important APIs · Call LaunchUriAsync to launch...
  22. [22]
    Launch Services Keys - Apple Developer
    Jun 4, 2018 · LSApplicationQueriesSchemes ( Array - iOS) Specifies the URL schemes ... macOS) specifies the earliest macOS version for a set of architectures.
  23. [23]
    Some email clients are vulnerable to attacks via 'mailto' links - ZDNet
    Aug 18, 2020 · A lesser-known technology known as "mailto" links can be abused to launch attacks on the users of email desktop clients.
  24. [24]
    VU#393305 - Microsoft Office mailto URI remote code execution
    Mar 11, 2008 · Outlook exposes a vulnerability due to inadequate checking of parameters passed to the Outlook email client. The vulnerability is caused due to ...Missing: risks | Show results with:risks
  25. [25]
    How to Safely Share Your Email Address on a Website - CSS-Tricks
    Oct 6, 2022 · In this article, I am going to show you how to easily protect your email address from spam bots with multiple solutions.The Html Approach · The Javascript Approach · The Embedded Form ApproachMissing: risk | Show results with:risk
  26. [26]
    Tip: Avoid Using Mailto Links in HTML Email - Campaign Monitor
    Apr 17, 2019 · In short, mailto links are unreliable and sometimes rather alarming for recipients, so please try not to use them in your email content at all.
  27. [27]
  28. [28]
    Email obfuscation: What works in 2025? - Spencer Mortensen
    Aug 28, 2025 · The only practical way to restore the “mailto” link is to run your custom conversion function in a web client with DOM and JavaScript support.Missing: modern interception
  29. [29]
    Input Validation - OWASP Cheat Sheet Series
    This article is focused on providing clear, simple, actionable guidance for providing Input Validation security functionality in your applications.Missing: mailto URI
  30. [30]