HTML HTML intro.
  1. HTML intro
  2. Web pages and you
HTML basics
  1. HTML getting started
  2. HTML basics
  3. HTML document
HTML text
  1. HTML text formatting 1
  2. HTML text formatting 2
  3. HTML text formatting 3
  4. HTML fonts
  5. HTML entities
HTML links
  1. HTML links
  2. HTML email links
HTML images
  1. HTML images
  2. HTML image maps
HTML forms
  1. HTML forms
  2. HTML form labels
  3. HTML fieldset/legend
HTML tables
  1. HTML tables
  2. HTML tables concepts
HTML frames
  1. HTML frames
HTML backgrounds/color
  1. HTML backgrounds
  2. HTML colors
  3. HTML color shades
  4. HTML color usage
HTML style/layout
  1. HTML stylesheets
  2. HTML div/span
HTML media
  1. HTML audio
  2. HTML video
  3. HTML objects
  4. HTML download media
HTML declaratives
  1. HTML head section
  2. HTML meta tags
  3. HTML scripts
  4. HTML declarations
  5. HTML document types
Practical HTML
  1. HTML tag rules
  2. HTML things to avoid
  3. URL formatting
  4. URL encoding/decoding
  5. HTML use/access
  6. HTML publish work
HTML extras
  1. HTML marquees
HTML wrap-up
  1. HTML history
  2. HTML summary

Email links

You can create links on webpages not just to other webpages and resources, but to an email message as well.

This tutorial focuses on:

Creating a basic email link

To create a basic email link the <a> tag is used just as it is used for regular links but instead of the href attribute taking the value of a URL, it takes the value of mailto: followed by the email address that the message will be sent to.

Example:
<a >href="mailto:admin@landofcode.com">Contact us!</a>
Output:

Click on the above link and it will open a new email message in your email program (the default email program you use such as Mozilla Thunderbird or Microsoft Outlook Express) with the "to" field already filled in.

NOTE: A websites visitor must have an email program (such as Mozilla Thunderbird or Microsoft Outlook) installed and configured on their computer for the email link to work. If you clicked on the email link and it did not work, that is probably the reason why.

A more complex email link

You can create even more complex email links that fill in the subject as well as the body of the email, not just the email address that the message will be sent to. This is achieved by using the word subject in the link followed by the subject of the message, and the word body followed by the message itself.

NOTE: When creating an email link with a subject and/or body, make sure to always separate the email address from this information using a question mark ( ? ), and also the subject and body information should be separated by an ampersand ( & ).

Example:
<a href="mailto:admin@landofcode.com? >subject=Hi, cool website!&body=I am reading the page on email links. HTML is cool."> Contact us! </a>
Output:

Click on the above link and it will open a new email message in your email program (the default email program you use such as Mozilla Thunderbird or Microsoft Outlook Express) with the "to" field already filled in as well as the subject field filled in with the value "Hi, cool website!" and the body of the email filled in with the value "I am reading the page on email links. HTML is cool."

NOTE: A websites visitor must have an email program (such as Mozilla Thunderbird or Microsoft Outlook) installed and configured on their computer for the email link to work. If you clicked on the email link and it did not work, that is probably the reason why.

Disadvantages of email links

Although email links serve a useful purpose, there are some disadvantages to them.

Sending email directly from a webpage

So an email link when clicked on opens an email program to send an email, but how do you send an email directly from a webpage?

Achieving this is not possible with HTML and actually requires a server-side language like PHP. And besides this, other things have to be configured and working such as the email server that a website is using.

© Copyright 2013-2014 Landofcode.com
Terms of use | Privacy policy | Copyright information