24 out of 47 rated this helpful - Rate this topic

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, such as %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

Windows Internet Explorer 7 and later. You must percent-encode all URL-reserved characters within a mailto: address. For example, the number sign (#) is used as a fragment identifier in URLs. When processing an address such as some#one@example.com, Internet Explorer copies only the portion up to the number sign into the mail client; the fragment portion including the number sign is ignored. This behavior is by design.

For more information on the mailto protocol, see RFC2368: The mailto URL scheme.

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>
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
mailto Parameter limit
I use VBA in MS Access and use the application.followhyperlink mailto: method regularly. Prior to VBA v6, there was a 6K byte limit for the total parameter string passed from VBA with a limit of 2K bytes for any individual parameter (CC, BCC, etc.). In VBA v6, the parameter limits changed (I haven't been able to find any documentation on the topic) and it now appears that the maximum string length for any individual parameter is about 950 bytes versus the 2K limit in earlier versions of VBA.
Limitation in IE8

It appears that there is a limitation. I would happily retract my response if someone can show otherwise.

In the following anchor, the href field is 512 characters long. One character longer and no email is generated, IE becomes unstable.

<a href="mailto:name@name.com?subject=123456789&amp;body=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111234">this is the limit of mailto on Outlook and IE8</a>


Esther Fan, MSFT: Thank you for your comments. For these kinds of questions, please try the following forums:
http://social.msdn.microsoft.com/Forums/en-US/category/iedevelopment
attachments

How can you attach files in Outlook 2007? I tried the double quotes and everything else i can think of but have gotten nowhere.

btw, when i use the double quotes, i get an error message saing the command line argument is not valid and i should verify the switch i am using.
i have no idea what this means, but any other time i just get an email with no attachment.

please help me

Esther Fan, MSFT: Thank you for your comments. For these kinds of questions, please try the following forums:
http://social.msdn.microsoft.com/Forums/en-US/category/iedevelopment

Multiline Body
To apply a multi line message in the body use can use the hex values for carriage return and line feed (%0D%0A).
Typo in first example
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.
Successful Outlook 2003 Mailto Attachment Syntax

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>

Attachments

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.