-2

I am learning HTML from w3schools HTML Tutorial - The Best in Class Tutorial

I come across one HTML form example which sends an email.

Please note that currently neither do I nor w3schools is going for server side input processing, so you also don't think about server side processing while considering my question.

Below is the code of HTML example :

<!DOCTYPE html>
<html>
<body>

<h2>Send e-mail to someone@example.com:</h2>

<form action="mailto:someone@example.com" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name"><br>
E-mail:<br>
<input type="text" name="mail"><br>
Comment:<br>
<input type="text" name="comment" size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>

</body>
</html>

Normally I see a .php or .asp filename in action attribute of a form but in above example it's mailto:someone@example.com.

I want to know what is it and why they have not used a .php or .asp file-name as they normally do?

Please someone explain me.

Thank You.

PHPLover
  • 1
  • 51
  • 158
  • 311

1 Answers1

1

You are basically giving the users browser the job of handling the mailto request. The browser usually starts the users mail client and fills in the fields according to the input of your form.

DevNico
  • 138
  • 1
  • 12
  • By 'Mail Client' do you mean Microsoft Outlook, Thunderbird, etc.? – PHPLover Aug 31 '16 at 09:18
  • 1
    Yes thats what I meant. – DevNico Aug 31 '16 at 09:39
  • So, is "mailto" also an HTTP service/method like GET and POST? – PHPLover Aug 31 '16 at 09:49
  • 2
    No, Mailto is a type of HTML link that activates the default mail client on the computer for sending an e-mail. The web browser requires a default e-mail client software installed on his computer in order to activate the e-mail client. If you have Microsoft Outlook, for example as your default mail client, pressing a mailto link will open a new mail window. – DevNico Aug 31 '16 at 11:47