Creating Advanced XHTML Email Links: Include Subject, CC, BCC, and Email Body

By  on  

Creating email links is a piece of cake, right? It's as simple as:

<a href="mailto:live@wembley.com">Email Oasis</a>

Everyone knows this. Did you know, however, that you can include subject, CC, BCC, and email body text information in the link as well? Using a querystring-like syntax, you can do more with that simple link.

<a href="mailto:live@wembley.com">Email Oasis</a>

<!-- add the subject -->
<a href="mailto:live@wembley.com?Subject=Your Next Show">Email Oasis</a>

<!-- add the cc's and bcc's -->
<a href="mailto:live@wembley.com?Subject=Your Next Show&CC=johnl@beatles.com&BCC=paulm@wings.com">Email Oasis</a>

<!-- add some default body text -->
<a href="mailto:live@wembley.com?Subject=Your Next Show&CC=johnl@beatles.com&BCC=paulm@wings.com&Body=I can't wait for the next show!">Email Oasis</a>

Remember that simply placing email addresses on a page without encoding them first is like simply emailing spammers your email address. Encode your email addresses!

Recent Features

  • By
    CSS 3D Folding Animation

    Google Plus provides loads of inspiration for front-end developers, especially when it comes to the CSS and JavaScript wonders they create. Last year I duplicated their incredible PhotoStack effect with both MooTools and pure CSS; this time I'm going to duplicate...

  • By
    JavaScript Promise API

    While synchronous code is easier to follow and debug, async is generally better for performance and flexibility. Why "hold up the show" when you can trigger numerous requests at once and then handle them when each is ready?  Promises are becoming a big part of the JavaScript world...

Incredible Demos

  • By
    Editable Content Using MooTools 1.2, PHP, and MySQL

    Everybody and their aerobics instructor wants to be able to edit their own website these days. And why wouldn't they? I mean, they have a $500 budget, no HTML/CSS experience, and extraordinary expectations. Enough ranting though. Having a website that allows for...

  • By
    Hot Effect: MooTools Drag Opacity

    As you should already know, the best visual features of a website are usually held within the most subtle of details. One simple trick that usually makes a big different is the use of opacity and fading. Another awesome MooTools functionality is...

Discussion

  1. Your post here saved me some time at work, so thanks. I can just never remember if its PHP or URL encoding that is choosy about how CC is written (cc, CC, or Cc).

  2. garrobo

    George,

    I need help on getting a comment system like the one I’m writing on, my question to you is how to get it to my website is there a code that I need to download or do I need to purchase it let me know
    I’m in love with it. thanks

  3. I’d like to thank you, for this tutorial, as a newbie in xhtml, its a lot of thing i never know before, thanks for this ‘mailing’ tutorial. Im sorry for this bad english

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!