3

I have an HTML form on my website. The form has various fields and on the submit button click i wish the data filled is sent to directly an email address. .

I am using POST method .

However when i enter the data and submit , it opens default email client (Outlook). Where as i want, that the data should be sent directly to the address is specified without opening default email client. It should be abstracted for user.

Here is my Code :

 <form id="form2" method="get" class="contact_us" action="mailto:[email protected]">
<p><font face="Arial, Helvetica, sans-serif">
 <label>Name
 <input type="text" class="fields_contact_us" name="textfield" />
 </label>
 <label>E-mail
 <input type="text" class="fields_contact_us" name="textfield2" />
 </label>
 <label>
Your message:
<textarea name="textarea" cols="" rows=""></textarea>
 </label>
 <label>
 <input type="submit" class="submit_button_contact" name="Submit3" value="Submit" />
 </label>
</font></p>

can anyone please suggest what shall be the best thing to do here ?

General Grievance
5,12039 gold badges40 silver badges60 bronze badges
asked Jan 20, 2012 at 17:55
5
  • You'll not be able to do this using just HTML. You'll need something server side (PHP will probably be cheapest for you to host and there's a plethora of free resources/scripts out there) to handle the POST data and compose an e-mail. There are probably a bunch of services which'll do this for you, have a Google for something like, "email me HTML web forms" and have a shop around. I'm sure there'll be some free solutions knocking about. Best of luck Commented Jan 20, 2012 at 18:01
  • My Hosting Server's info: Hosting package 500MBx800 Server Name s1 cPanel Version 11.30.5 (build 6) Theme x3 Apache version 2.0.63 PHP version 5.2.16 MySQL version 5.0.92-community Architecture x86_64 Operating system linux Shared IP Address 67.225.203.66 Path to sendmail /usr/sbin/sendmail Path to Perl /usr/bin/perl Kernel version 2.6.9-67.0.7.ELsmp cPanel Pro 1.0 (RC1) Commented Jan 20, 2012 at 18:02
  • typedef1, since you have PHP on there see Tim's answer below regarding the search query you can use to get a bunch of tutorials on how to achieve what you're wanting. Commented Jan 20, 2012 at 18:08
  • You're using get method in the form Commented Oct 18, 2018 at 21:27
  • This question is similar to: How to send email from HTML Form. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Apr 10, 2025 at 7:31

5 Answers 5

4

You'll need to pass it to a page with a server-side language such as .

That page will handle the request and send the email.

answered Jan 20, 2012 at 18:06
Sign up to request clarification or add additional context in comments.

Comments

1

If you're running a static HTML site, it may be inconvenient or challenging to run your own backend to collect form data.

There are bunch of form backend providers that you can use to collect data from your forms in the cloud and, from there, process data into email or to other systems like mailchimp, hubspot, google apps and so on.

Formkeep is one such solution.

All you would need to do is all you need to do is update the action attribute. Your form tag should look like this paying careful attention to update the underlined area of the highlighted URL with the token provided to you within FormKeep:

<form accept-charset="UTF-8" action="https://formkeep.com/f/exampletoken" method="POST">

From Formkeep you can send to email, slack or a bunch of other applications.

answered Oct 18, 2018 at 21:21

Comments

0

Using URIs with the mailto: scheme in the action attribute does not work.

You need to use an HTTP (or HTTPS) URI with a server side form handler.

You may be able to install one on your existing hosting. The specifics of how do to that will depend on which server side languages are supported, your personal preferences about those language and how the server is configured to run them.

answered Jan 20, 2012 at 18:04

Comments

0

First of all some things are incorrect in your code, for example your form uses the get method instead of post.

Furthermore you have to create some kind of backend script which is available to mail, you can use for example PHP, but their are other possibilities such as ruby, or ASP. mailto:[email protected] is simply not enough to send mail, all form fields will be pasted together and some browsers (for example opera) will not even support this action.

If you really want this add enctype="text/plain" to your form line but also old netscape browser don't know how to handle this.

Google to something like "simple PHP e-mail form" to get multiple results about how to create an email form, hope this will help you.

answered Jan 20, 2012 at 18:05

1 Comment

The thing is i have configured it using Google docs form. But only issue is i have to use form created by google. Rather i wish to use my own form
0

The common solution is to post the data to a server page that is capable of sending emails via SMPT.

Reasons it isn't so easy. I can think of two:

  1. There are security concerns if emails are allowed to be sent programmatically from the browser (client-side), namely, that too much information is exposed. This would be overly abused by spammers.
  2. Most emails are sent using TCP, which is a lower-level communication protocol than HTTP (what the browser/js is intended for). It would be akin to having a button on an ATM machine for buzzing the bank manager.
answered Jan 20, 2012 at 18:06

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.