要使用HTML表单发送电子邮件,您需要将电子邮件ID添加到表单的action属性。在此,添加电子邮件,以mailto开头:即mailto:emailid@example.com。
您可以尝试运行以下代码以使用HTML表单发送电子邮件-
<!DOCTYPE html> <html> <body> <h2>Student Contact Form</h2> <form action="mailto:emailid@example.com" method="post" enctype="text/plain"> Student Name:<br><input type="text" name="sname"> <br> Student Subject:<br><input type="text" name="ssubject"><br> <input type="submit" value="Send"> </form> </body> </html>