基本上我是网站设计的初学者,我需要帮助确定我在这个联系表单中实际发送电子邮件的位置作为收件人我已经看了5次这样的代码而且我知道我的probs错过了某个地方但是可能有人告诉我在代码中我把我的电子邮件地址作为收件人!!
下面是代码的链接:
继承人我的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>
答案 0 :(得分:0)
如果您想依靠浏览器使用Outlook或用户的客户端发送电子邮件,
使用
<form action="mailto:myemail@domain.com" method="post">
虽然这不是一个好主意,但是,大多数人只是使用webamil。所以你需要一台服务器为你转发电子邮件。你需要用php,asp,java或其他东西编写代码,或使用允许你转发电子邮件的服务
答案 1 :(得分:0)
如果您要查找已填写表格的电子邮件地址,则不在此处。表单由AJAX调用提交到服务器端脚本processEmail.php
- 在那里查找地址
答案 2 :(得分:0)
假设您要将通过表单提交的信息发送到您的电子邮件地址,这是您需要在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.0\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\n";
$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>" ;
}
}
&GT;