Thomas Brunt's OutFront Hosting
 
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Getting More From 'mailto'  
Newsletter Article, July 2002

Just about every site has one or more 'mailto' links, allowing people to send email directly from a web page.

A standard mailto link looks like this:

<a href="mailto:someone@yoursite.com">Email Us</a>

With the effect we expect from any email link - hyperlinked text that fires up a new message window with the recipients email address conveniently filled in already. 

Like this one: Mail me

But the mailto link can be made to work much harder than that. You can have it add a subject line, send copies to multiple recipients or even write the entire email message.

1. Add a Subject Line

You can prefill the subject line in the email by adding the subject preceded by '?subject=' after the email address.

So the link now becomes:

<a href="mailto:someone@yoursite.com?subject=Mail from Our Site">Email Us</a>

You can see the effect of that if you click here.

2. Send to Multiple Recipients

Mail can be sent to additional recipients either as carbon copies (cc) or blind carbon copies (bcc).

This is done in a similar way, by placing '?cc=someoneelse@theirsite.com' after the initial address.

So the link looks like this:

<a href="mailto:someone@yoursite.com?cc=someoneelse@theirsite.com">Email Us</a>

cc can simply be replaced by bcc if you wish to send blind carbon copies.

This can be very useful if you have links on pages with different subjects. You might have the email on each page go to the appropriate person in a company but with a copy of all mails sent to a central address also. 

You can of course specify more than one additional recipient, just separate your list of recipients with a comma.

<a href="mailto:someone@yoursite.com?cc=someoneelse@theirsite.com, another@thatsite.com, me@mysite.com">Email Us</a>

3. Combining Code

You can combine the various bits of code above by the addition of an '&' between each.

Thus adding 
me@mysite.com?subject=Hello&cc=you@yoursite.com&bcc=her@hersite.com


would send an email with the subject 'Hello' to me, you and her.

4. Write the Email

You can also prefill the body of the email with the start of a message, or write the whole message if you like! To add some thing to the body of the email it is again as simple as above - '?body=' after the email address. However formatting that email can be a little tricky. To create spaces between words you will have to use hex code - for example '%20' between each word, and to create new lines will mean adding '%0D'. Similarly symbols such as $ signs will need to be written in hex code.

If you also wish to add a subject line and send copies to multiple recipients, this can make for a very long and difficult to write bit of code.

Try this link for example. It will send a message to three people, with the subject and the message filled in, all you need to do is add your name. 
(You don't actually need to send it by the way, the answer is - ME!)

But just look at the code!

<a href="mailto:abbeyvet@outfront.net?CC=spooky@outfront.net
&BCC=thomasbrunt@outfront.net&Subject=Please%2C%20I%20insist
%21&Body=Hi%0DI%20would%20like%20to%20send%20you%20
%241000000%20to%20divide%20as%20you%20see%20fit%20among
%20yourselves%20and%20all%20the%20moderators.%0DPlease%
20let%20me%20know%20to%20whom%20I%20should%20send
%20the%20check.">this link</a>

Fortunately help is at hand. 

5. Generate Mailto links. 

This neat little generator allows you to generate all the code for your mailto links, just fill in your information and the copy and paste the generated code into your page. Easy! 

Mailto Link Generator


 

Fun With Background Images
Fun With Bulleted Lists
Are You Compliant?
Introduction To Cascading Style Sheets
Creating Custom Error Pages
Designing Fast Loading Sites
Creating Funky Forms With CSS
htaccess Magic
An Introduction To JavaScript
JavaScript Snippets
Getting More From Mailto
Installing And Using Perl Scripts
Preparing Photos For Your Web Site
The Popup Dilemma
Paint Shop Pro Album 4
Creating And Using robots.txt File
Creating JavaScript Rollover Buttons