Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Content Extensions
Pluggable Protocols
 mailto Protocol
mailto Protocol

Opens a client's e-mail system and begins a new email message.

Syntax

mailto:sAddress[sHeaders]

Tokens

sAddress
One or more valid e-mail addresses separated by a semicolon. You must use Internet-safe characters. Use %20 for the space character.
sHeaders
Optional. One or more name-value pairs. The first pair should be prefixed by a "?" and any additional pairs should be prefixed by a "&". The name can be one of the following strings.
subject
Text to appear in the subject line of the message.
body
Text to appear in the body of the message.
CC
Addresses to be included in the "cc" (carbon copy) section of the message.
BCC
Addresses to be included in the "bcc" (blind carbon copy) section of the message.

Remarks

For more information on the mailto protocol, see RFC 2368 World Wide Web link.

Examples

The following example shows a mailto URL that will prepare an e-mail message when typed into the Internet Explorer address bar.

mailto:user@example.com?subject=Message Title&body=Message Content"

The following example shows a link that will prepare an e-mail message.

<a href="mailto:user@example.com?
    subject=MessageTitle&amp;
    body=Message Content">
    Contact Us</a>

The following example shows how to use an HTML form to create an e-mail message.

<form action="mailto:user@example.com" method="get">
<input name="subject" type="hidden" value="Message Title">

Feedback:<br/>
<textarea name=body cols="40">
Please share your thoughts here
and then choose Send Feedback.
</textarea>

<input type="submit" value="Send Feedback">
</form>
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Attachments      adam_m ... danielszabo1981   |   Edit   |   Show History

There is no official way to attach files using "mailto" protocol. Most likely because of the security reasons.

However some email clients do accept the attachment parameter with the file in quotes i.e. attachment="C:\fileName.txt" such as outlook 98.

Tags What's this?: Add a tag
Flag as ContentBug
Multiline Body      JK6 ... Thomas Lee   |   Edit   |   Show History
To apply a multi line message in the body use can use the hex values for carriage return and line feed (%0D%0A).
HTML Format in Body      Kanya ... Jiří Valerian   |   Edit   |   Show History

How to add HTML format in Body in mailto.

for e.g. I want to add something like this

<a href="mailto:user@example.com?subject=MessageTitle&amp; body=<b>Body text</b>">Contact Us</a>

Mailto protocol (see RFC 2368) not supported HTML formating in body.
Successful Outlook 2003 Mailto Attachment Syntax      danielszabo1981   |   Edit   |   Show History

Outlook 2003 mailto:'s "&Attachment" tag relies on double quotes:

<a href='mailto:name@domain.com?Subject=SubjTxt&Body=Bod_Txt&Attachment=""C:\file.txt"" '>

Attach with double-quotes!

</a>

Tags What's this?: Add a tag
Flag as ContentBug
Typo in first example      Kurt L Hudson   |   Edit   |   Show History
The double-quotes at the end of the first example in this article appears to be a typo. mailto:user@example.com?subject=Message Title&body=Message Content" If I remove the double quotes at the end, then things work fine.
Tags What's this?: typo (x) Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker