1. Computing

Discuss in my forum

When Mailto Forms Don't Work

Mailto Forms are Easy But they Don't Always Work

By

Mailto forms are not always as reliable as we would hope. It seems like a simple thing, click the form button and it should send the form data by email. But mailto forms aren't always that simple.

“When I hit submit on my web form, all I get is a blank email message.”

This is a common complaint when some people use mailto web forms. You or your customer carefully fills out the form, but then, instead of mailing the form contents to the mailto address, it opens the email client.

“When I fill in the form, it sends a blank email with strange codes in the subject line”

Sometimes, the email client has a subject that looks something like: ?name=jennifer&email=webdesign@aboutguide.com&comments=these are my comments but the body of the email is blank. And sometimes, there is nothing from the form that is added to the email at all.

This is the Problem with Mailto Forms

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.

This issue depends on many factors, including:

  • operating system
  • web browser and version
  • email client and version
  • other unknown 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.

What Can You Do to Fix Broken Mailto Forms?

If you are a web developer using forms, and you want to use a mailto form, you should be aware of this limitation. No matter what you do, some of your customers may not be able to use the form.

If you still want to use a mailto form on your site, you should make sure your forms are correct. And you should validate your HTML to make sure there aren't other problems.

The Best Solution for Broken Mailto Forms

I strongly recommend that you use a CGI or PHP script instead of a mailto form. There are many ways you can use a CGI even if you don't know how to program. Here are some resources that can help:

  • Feedback forms - Use these email feedback forms for your web forms.
  • Write Your Own CGI—Using Perl or other CGI language, you can write your own CGI to process the form. The benefit to this is that you can make the CGI do whatever you need.
  • Make Sure The Email is Correct—Whatever type of form you use, you can use JavaScript to validate it. And this script will validate a field for a correctly formatted email address.

This article is part of the HTML Forms Tutorial

©2014 About.com. All rights reserved.