基本上我是一个巨大的网页设计初学者,我需要帮助确定我实际上把我的电子邮件放在这个联系表单作为收件人我已经看了5次代码,我知道我可能错过了它的某个地方,但有人能告诉我在代码的哪里我把我的电子邮件地址作为收件人!!
下面是代码的链接:
http://jsfiddle.net/VkeP5/这是我的html,其余的在jsfiddle上
<head>
<meta charset="UTF-8">
<title>{name} Portfolio - {Page Name}</title>
<!-- grabs the latest jquery script from google -->
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/processForm.js"></script>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="contactForm">
<div id="contactForm_messageToUser">Your message has been sent.<br />We will be in contact shortly.</div>
<!-- The form that the user will fill out. -->
<form id="contactForm_form">
<table>
<tr>
<th>
Name
</th>
<td>
<input id="user_name" name="user_name" type="text" value="" />
<div id="user_name_message" class="errorMessage">
Please enter your name.
</div>
</td>
</tr>
<tr>
<th>Phone</th>
<td>
<input id="user_phone" name="user_phone" type="text" value="" />
<div id="user_phone_message" class="errorMessage">
Please enter a valid phone number.
</div>
</td>
</tr>
<tr>
<th>Email</th>
<td>
<input id="user_email" name="user_email" type="text" value="" />
<div id="user_email_message" class="errorMessage">
Please enter a valid email address.
</div>
</td>
</tr>
<tr>
<th>Message</th>
<td>
<textarea id="user_message" name="user_message"></textarea>
<div id="user_message_message" class="errorMessage">
Please enter your message.
</div>
</td>
</tr>
<tr>
<th> </th>
<td>
<input id="user_submit" name="user_submit" type="submit" value="Send your message" />
</td>
</tr>
</table>
</form>
</div>
</body>
假设您希望将通过表单提交的信息发送到您的电子邮件地址,这就是您需要在processEmail.php中更改的内容:
<?php
if (isset($_POST['user_submit']) && $_POST['user_submit'] != ''){
$body = "Name: " . $_POST['user_name'] . "<BR>";
$body.= "Phone: " . $_POST['user_phone'] . "<BR>";
$body.= "Email: " . $_POST['user_email'] . "<BR>";
$body.= "Message: " . $_POST['user_message'];
$to = "Your Email Address";
$subj = "User Form Submitted";
$headers = "MIME-Version: 1.0n";
$headers.= "Content-type: text/html; charset=iso-8859-1n";
$headers.= "From: ".$_POST['user_email']."n";
if (mail($to,$subj,$body,$headers)){
echo "<h2>Message Sent</h2>";
}
else{
echo "<h2>Unable to submit the form, please recheck the details.</h2>" ;
}
}
?>
如果你想依靠浏览器使用outlook或用户的客户端发送电子邮件,
使用<form action="mailto:myemail@domain.com" method="post">
虽然这不是一个好主意,因为,大多数人只是使用webamil。所以你需要一个服务器来帮你转发邮件。你需要用php, asp, Java或其他语言编写代码,或者使用允许你转发电子邮件的服务
如果您正在寻找将完整表单发送到的电子邮件地址,它不在这里。表单通过AJAX调用提交给服务器端脚本processEmail.php
—查找地址