Knowledge base

How to Create an HTML Form That Sends an Email

Reinhard Söllradl Updated: December 18, 2024 6:30 min. reading time
Title image for: How to Create an HTML Form That Sends an Email
Portrait photo Reinhard Söllradl

Founder of Form.taxi and web developer since 2000.


Last updated on
December 18, 2024

6:30 min. reading time

There is a good reason why almost every website today has an online form with email delivery. It is a practical way for site visitors to establish direct contact and transmit personal information. However, the technical implementation of an email form has some pitfalls. In this article, we will show you the advantages and disadvantages of the various technical options and you will learn how to send your HTML form easily and securely by email.


How does an HTML form transmit the input?

An HTML form is used on websites to collect and forward input from site visitors. A practical solution here is to receive the site visitor's input directly in an email message when a form is submitted. This allows you to further process the submitted information and respond to the user's request.

Below we will show you the options for integrating the email transmission function into an existing HTML form. If you don't have the form yet, you can learn how to create an HTML form using the following link.

How to create a form in HTML?

It would be ideal if web browsers could send forms directly to email addresses. Unfortunately, this is not the case. This is probably because it does not open the door to spam abuse, as the target address would appear unprotected in the HTML source code.

As we explain in Method 1, you can enter an email address for delivery in the action attribute of the HTML form. However, this only results in the user's standard email program being opened with a dialog for a new email message when the form is submitted. It is not possible to check whether the user is using an email program at all and whether he or she subsequently sends the message.

How to set up email delivery for an HTML form?

There are several ways to send forms to an email address. Below we will explain these options and show you their features. This way you can choose the solution that best suits your needs and your technical knowledge.

Let's start with the simplest method.

Method 1: Mailto link in HTML code

There is no feature in HTML that sends an email directly. But with a mailto link you can instruct the browser to forward the form entries to the user's standard email program. To do this, enter the target address in the HTML code of your form. In order for the email program to be called, the email address must be preceded by "mailto:". To illustrate this, look at the following HTML source code of a simple form:

<form action="mailto:example@domain.com" method="post" enctype="text/plain">
<input type="text" name="Your name">
<input type="text" name="Address">
<input type="submit" value="Submit">
</form>

When the form is sent, the email program opens with a dialog for a new email message. The target address is adopted as the recipient address and all form entries are inserted as email content. The user can now change the content as desired and send the message to be transmitted.

The setup is very simple, but unfortunately this method has some disadvantages. The different browser programs handle the mailto link differently or not at all, so that it does not work reliably. Furthermore, the form entries are transferred to the email message in a desert of text without any formatting.

The only advantage of this method is the ease of integration. However, due to the significant disadvantages, serious use is not recommended.

  • Very simple implementation
  • uncertain support
  • depends on the user's software environment
  • no control over the sending process of the email
  • E-mail address can be read in the source code = risk of spam!

Read on to find out how you can avoid these disadvantages with the following methods!

Method 2: Formmailer script

A so-called formmailer script is a small program that receives the form submission on the web server and forwards the data to an email address.

This is technically the most demanding method, as it requires a certain level of specialist knowledge, particularly if the installation is to be carried out according to your own requirements and in the safest possible way.

A short digression to illustrate how a form mailer works. The website with your form is called the frontend and the execution takes place in the user's browser program. When the form is sent, all form entries are sent to the so-called backend, which is operated on the website server. A small software program is executed there, which takes care of processing the form entries. So that the browser knows where to reach this backend, the web address of the backend is entered in the action attribute in the HTML source code of the form.

Illustration of form transfer via backend

Such a backend program, which accepts form submissions and sends an email, is usually referred to as a formmailer or form mail script. There are countless such scripts that can be found on the Internet for free for your own use. Most of them are written in the PHP programming language, as this scripting language is supported by almost every web host. But other languages such as Perl, Python, ASP or server-side JavaScript are also possible.

Setting up a formmailer is done in the following steps:

  1. Download the formmailer script or program it yourself
  2. customize the script and enter your own destination address
  3. Upload script to webspace
  4. enter the formmailer script as the target address in the HTML form

There are countless formmailers available for free use on the Internet. One such formmailer in the PHP programming language is available from Tectite.com: Tectite FormMail.

Setting up a formmailer can be challenging because it requires a good basic knowledge of web development. You should have enough understanding of the respective programming language to be able to adapt the mailer script to your own requirements and to understand what the programming does exactly.

This brings us to the advantages and disadvantages of using formmailer:

  • free use
  • adaptable to requirements
  • E-mail address cannot be read
  • sufficient specialist knowledge required
  • high cost of setup and operation

With the 3rd method we show you a solution that can be set up quickly and easily.

Method 3: Form backend

As we have seen, the first method is not reliable, and the second is really not easy to set up and certainly not an optimal technique for everyone.

That's why professional form backends are a good solution for sending web forms by email. Such form backends are online services that specifically take care of accepting form submissions and their further processing.

The integration into your own HTML form is very simple and usually only requires entering an individual target address in the HTML source code of the form. The online service then takes over the processing of incoming mail, such as reliably sorting out spam mail, and sends receipt messages to the specified email recipients.

  • Very easy integration
  • free basic use
  • adaptable to requirements
  • many setting options and functions
  • hardly any specialist knowledge required
  • Protection against spam and abuse
  • ideal for static websites

In addition to email notifications, the Form.taxi form backend offers a number of other functions, such as auto-response emails, file uploads, an online submission archive and many setting options to adapt the processing of your form to your exact requirements. You can find a description of this service with all its functions on Form.taxi form backend.

Set up form submission now

Request a sending address for your HTML form here. With this connection, the Form.taxi backend takes over the delivery of the submissions and the form is immediately functional.

Request send address


Frequently asked questions

A website form in which the form entries are sent as an e-mail message to one or more target addresses.

A small online script that accepts form submissions and sends them to an e-mail address. Such scripts are available in various programming languages and must be installed on a web host.

An online service that takes care of receiving and processing HTML form submissions. The service is operated independently of the website by a provider such as Form.taxi, making it very easy to integrate into a web form.