Search code examples
htmlemailformsmailtoemail-client

What is "mailto:someone@example.com" in following HTML form example?


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.


Solution

  • 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.