我需要在 hostgator 中创建一个自定义表单,并且应该能够将表单输入发送到我的电子邮件地址。
我是 html 和一般形式的新手。
我已使用以下链接上的代码创建基本 html 文件:https ://support.hostgator.com/articles/custom-form-mail 我创建的表单运行良好,只是我没有收到任何电子邮件。
我需要为此创建一个php文件吗?我也不确定在 value="http://www.example.com/redirect-path"> 部分放什么。
我正在使用 Hostgator 网站构建器。我对一般形式不熟悉
============== 我遵循的代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>FormMail Demo</title>
<script type="text/javascript">
function hgsubmit()
{
if (/\S+/.test(document.hgmailer.name.value) == false) alert ("Please provide your name.");
else if (/^\S+@[a-z0-9_.-]+\.[a-z]{2,6}$/i.test(document.hgmailer.email.value) == false) alert ("A valid email address is required.");
else if (/\S+/.test(document.hgmailer.comment.value) == false) alert ("Your email content is needed.");
else {
document.hgmailer.submit();
alert (' Thank you! \n Your email is sent.');
}
}
</script>
</head>
<body>
<form action="http://www.example.com/cgi-sys/formmail.pl" method="post" name="hgmailer">
<input type="hidden" name="recipient" value="myemail@mydomain.com">
<input type="hidden" name="subject" value="FormMail E-Mail">
Whatever you want to say here<br><br>
Visitor Name: <input type="text" name="name" size="30" value=""><br>
Visitor E-Mail: <input type="text" name="email" size="30" value=""><br>
E-Mail Content: <textarea name="comment" cols="50" rows="5"></textarea><br><br>
<input type="button" value="E-Mail Me!" onclick="hgsubmit();">
<input type="hidden" name="redirect" value="http://www.example.com/redirect-path">
</form>
</body>
</html>