Kakalokia
Kakalokia

Reputation: 3191

Using mailto: to submit a form

I want to use a form which uses mailto to send the values typed in it to my e-mail. The thing is that when I type the values and click on submit, Windows Live Mail loads and then I have to send the data entered in the form from the Windows Live Mail. Is there a way to send the data entered the minute the submit button is clicked without an e-mail application loading up ?

this is the form

<form method="post" action="mailto:[email protected]">
<p>
 What is your name? 
<input type="text" name="MyName" size="30" maxlength="50">
</p>

<p>
What is your quest?
<input type="text" name="Quest" size="30" maxlength="100">
</p>

<p>
<input type="submit" value="Answer These Questions Three">
</p>
</form>

Upvotes: 0

Views: 837

Answers (3)

Mick MacCallum
Mick MacCallum

Reputation: 130193

This can be done easily using php, like so.

<?php
 $to = "[email protected]";
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";
 if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
 ?>

Upvotes: 1

sparkeh9
sparkeh9

Reputation: 21

The mailto is purely client-side, and will only result in your browser opening up a mail client.

TO programatically send an email, you'll have to use a server-side language

Upvotes: 1

deceze
deceze

Reputation: 522210

mailto: is specifically meant to open the email application on the client. It does not send an email all by itself. That would also be a bad idea, since it requires your website visitors to be correctly set up to send email, which is not necessarily a given.

You'll have to submit the form to a server-side script, which can send the values in an email.
Don't make the client do it.

Upvotes: 2

Related Questions