0

基本上我是网页设计的一个巨大的初学者,我需要帮助确定我在此联系表格中实际将我的电子邮件作为收件人我已经查看了 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>&nbsp;</th>
                    <td>
                        <input id="user_submit" name="user_submit" type="submit" value="Send your message" />
                    </td>
                </tr>

            </table>

        </form>

    </div>

</body>

4

3 回答 3

0

如果你想依靠浏览器使用outlook或者用户的客户端发送邮件,

利用

<form action="mailto:myemail@domain.com" method="post">

虽然这不是一个好主意,因为大多数人只是使用 webamil。因此,您需要一台服务器来为您转发电子邮件。你需要用 php、asp、java 或其他东西编写代码,或者使用允许你转发电子邮件的服务

于 2013-06-13T14:58:30.517 回答
0

如果您正在寻找将完成的表格发送到的电子邮件地址,它不在这里。表单通过 AJAX 调用提交到服务器端脚本processEmail.php- 在那里查找地址

于 2013-06-13T14:59:59.990 回答
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>" ;
        }
   }

?>

于 2013-06-13T15:12:18.067 回答