Tutorials
CSS
Web Design
XHTML
Javascript
PHP

Web Design Tutorials
Embedding fonts
Page Redirection
Access Hard Drives
Avoiding Spam Mail
Editable Page Content
Copyright Basics
File Include
Mailto Links
Maintain Framesets
Show the Hard Drive
Link Status Description


More information

Web Design Tutorials
Expanding the Mailto: tag

Introduction.
The Mailto tag is used as a way to include an email address on a web page which can be clicked on thus opening the visitors default email client with the email address prefilled. The mailto code can e expanded to include multiple email addresses, email addresses to CC and BCC, the email subject and even a message body.

Mailto: Tag

The following is the basic mailto tag:

<a href="mailto:name@domain.com">Mail me!</a>

Which would result in: Mail me!



Adding multiple recipients:

To add multiple mail addresses just add in more addresses after the first address separated by a comma:

<a href="mailto:name@domain.com,first@second.com,you@there.com">Mail me!</a>

Which results in the following, if you feel like clicking it: Mail me!



Adding emails to Carbon copy (CC) or blind carbon copy (BCC):

Adding recipients to copy the emails to just add cc= or bcc= after the email address.

<a href="mailto:name@domain.com?cc=me@here.com">Mail and CC!</a>
<a href="mailto:name@domain.com?bcc=john@doe.com">Mail and BCC!</a>

Which result in Mail and CC!, Mail and BCC!


You should note at this point that we needed to insert a "?" before the CC and BCC 'functions'. This is always the case even if you add a subject or message body here. The first 'function' after the main email addresses must start with a "?" while any extra 'functions' will start witha "&"

If we combine the previous examples this will become clearer:

<a href="mailto:name@domain.com?cc=me@here.com&bcc=john@doe.com">CC&BCC</a>
or
<a href="mailto:name@domain.com?bcc=me@here.com&cc=john@doe.com">BCC&CC</a>

Result: CC & BCC



Adding a subject:

To add a subject simple add "subject=" :

<a href="mailto:name@domain.com?subject=feedback">

Result: Mail & subject



Adding a message body:

To add a subject simple add "body=" :

<a href="mailto:name@domain.com?body=message">

Result: Mail & body

If you would like to add an extra line to the body of the email you must add %0d whereever you want the text to break to a new line.

<a href="mailto:name@domain.com?body=message%0dhere">Mail & body</a>

Result: Mail & body



Combining these...

We can combine the previous examples to make a comprehensive mailto link:

<a href="mailto:name@domain.com,john@doe.com?cc=sales@here.com&bcc=admin@there.com&subject=Complaint&body=Dear sir.%0dI have a complaint to make">Mail us!</a>

Result: Mail us!



Important notes:

  1. You are limited to 255 characters in your mailto link.
  2. Including email addresses in this way leave them vunerable to harvesting by spammers.
  3. These were tested in MS Outlook and Lotus Notes and performed correctly.

Discuss this in the Forum  
Search HeaphyDesigns



Stored Pages



Change Site Style
Select a style for the site:




More information