VirtualMV/HTML/Basic/Forms/mailto

From WikiEducator
Jump to: navigation, search



Introduction

Overview

A simple form can be created that will sent the results to an email address.However, use this method with caution. Unless the user's browser has an email client attached this probably will not work.

VmvIcon Objective.png

Using Mailto in a form

By the end of this page you will be able to:

  • Create a simple mailto form
  • Add prefilled in data to the mailto
  • Understand why mailto is not a good solution for web forms

Simple mailto redirect

To redirect a user to an email form if they have an email client that works with their browser add the following code in the link

<p>You can email 
   <a href="mailto:mverhaart.eit@gmail.com">the editor</a>
   from here</p>

which in the browser displays

You can email the editor from here

A fuller version;

<a href="mailto:mverhaart.eit@gmail.com?cc=tui@emu.co.nz 
   &bcc = kea@boss.com;kaka@slave.com &subject=Hi
   &body=Send more stuff!">everyone</a>
  • Where
    • cc = copy to
    • bcc = blind copy
    • subject = subject of email
    • body = email contents

Simple form mailto

A simple form can be created that will sent the results to an email address. For example

<form method="post" action="mailto:mverhaart.xyz@zmail.com" enctype="text/plain">
Enter your alias: <input type=text name=alias><br />
Comments: <input type=text name=comments><br />
<input type=submit value="Submit Your Comments">
</form>

Displaying this in your browser will show...

A simple form demonstrating mailto

Clicking [Submit] may create the following email..

From:   "Michael Verhaart" <mverhaart.xyz@zmail.com> 
To:   Michael Verhaart 
Date:   Friday - August 1, 2003 3:01 PM 
Subject:   Form posted from Microsoft Internet Explorer. 
Mime.822 (834 bytes)    [View] [Save As]  
   
alias=michaelv
comments=test of web form mail.

Unfortunately mailto is notoriously unreliable.....

When Mailto forms don’t work

Mailto forms rely on two things:

  1. The customer's system must have a default email client
  2. The customer's Web browser must be able to connect to that email client

If you create a page with a mailto form, and your customer doesn't have an email client on their system, the mailto form won't work. If their Web browser can't connect to the email client, the mailto form won't work.

The biggest problem is that this issue depends on many factors, including:

  • Operating system
  • Web browser and version
  • Email client and version
  • Other factors(?)

And while you might be able to use JavaScript to detect for browser and operating system - if it is the interaction between them and the email client, you will still have a problem. (Kyrnin, 2008)[1]

Setting your browser options to work with a web based email client

It is possible to test a mailto (e.g. testing that the [Submit] button on a form). Browsers will usually allow you to reset the default mail client in their options. The following examples show you how to change the default settings in various Browsers.

Internet Explorer

  • For Windows Live Hotmail and Windows Live
Internet Explorer - resetting the email client for mailto

Firefox

  • For Gmail.
Firefox - resetting the email client for mailto

Google chrome

Alternatives

An alternative to using the mail system is to use Google Docs form. Create a form in Google docs which allows you to update the data to a spreadsheet

VmvIcon References.png References

  1. Kyrnin, J. (2008) When Mailto Forms Don’t Work. Retrieved March 17, 2008 from http://webdesign.about.com/cs/forms/a/aamailtobroke.htm
  2. Make Gmail the Default Application for mailto Links in Google Chrome (2011) In HowToGeek. Retrieved March 14, 2011 from http://www.howtogeek.com/howto/3814/make-gmail-the-default-application-for-mailto-links-in-google-chrome/

virtualMV  |  Superquick wiki guide  |  Please give me some feedback

VirtualMV/HTML/Basic/Forms/mailto. (2024). In WikiEducator/VirtualMV wiki. Retrieved April 19, 2024, from http:https://wikieducator.org/VirtualMV/HTML/Basic/Forms/mailto    (zotero)