Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 发送邮件表单不发送邮件_Javascript_Jquery_Email - Fatal编程技术网

Javascript 发送邮件表单不发送邮件

Javascript 发送邮件表单不发送邮件,javascript,jquery,email,Javascript,Jquery,Email,我有一个表单,当用户点击一个链接,然后向他们选择的地址发送电子邮件时,它会弹出。表单看起来不错,但是电子邮件没有发送 <a href='#emailpopup' id='sendMessage'><img src="images/email.jpg"></a> <div id="tellfriend" class="contact_form"> <a class="close" href="#close" >Clo

我有一个表单,当用户点击一个链接,然后向他们选择的地址发送电子邮件时,它会弹出。表单看起来不错,但是电子邮件没有发送

<a href='#emailpopup' id='sendMessage'><img src="images/email.jpg"></a>

    <div id="tellfriend" class="contact_form">
      <a class="close" href="#close" >Close</a>
      <form id='tellafriend_form' method="post" action="http://naturesfootprintinc.com/sendmail.php">

        <label for="name">Your Name: </label>
        <input class="std_input" type="text" id="name" name="name" size="40" maxlength="35" value="" />

        <label for="to">Friend's email: </label>
        <input class="std_input" type="text" id="to" name="to" size="40" maxlength="35" />

        <label for="subject">Subject: </label>
        <input class="std_input" type="text" id="subject" name="subject" size="40" value="Check this out!!" />

        <label for="message">Message: </label>
        <textarea id="message" name="message" readonly="readonly" rows="18" cols="40">Custom message</textarea>

        <input type="submit" name="submit" class="form_but" value="Submit"/>
      </form> 
    </div><!-- #tellfriend -->
使用的脚本:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script> 
<script> 
$(function() {
    $('#tellfriend').hide();
    $('#sendMessage').click(function(e) {
        $("#tellfriend").fadeToggle('fast');
    });

});
</script>
Sendmail.php:

<body>
  <div id="thankyou">
    <h1><strong>Thanks for sharing!</strong></h1>
    <p><a href="http://homepage.com">Back to homepage</a></p>
  </div>
</body>

是的,我是个新手。感谢您的帮助和耐心。

您需要一些服务器端代码来发送邮件。仅仅拥有一张表格对你没有任何帮助

因此,要在单击时发送它,请执行以下操作:

 $('#sendMessage').click(function(e) {
    var $form = $('#tellafriend_form');
    $.post($form.get(0).action, $form.serialize(), function(data){
          //something on success
    })
    $("#tellfriend").fadeToggle('fast');
});

您使用什么代码发送邮件?表单是否已提交?这是客户端问题还是服务器端问题?您从不发送任何邮件。在任何地方句号。@blackessej:您希望发送sendmail.php的哪一部分的邮件?因为您从未发送过邮件,所以邮件不会被发送。你需要发送一封电子邮件才能发送它。php只是输出一些HTML,它实际上什么都不做,它需要发送电子邮件。这是我最初的想法,后来意识到这并不重要。javascript代码只是一条红鲱鱼。没有理由表单不能正常发布。@Wesley,是的,我明白了。没有id为sendMessage的div或按钮hmmmm@blackessej,如果您只需单击submit,它应该在没有任何js帮助的情况下提交,这是submit按钮。我是否只是将id sendMessage添加到此输入中?@blackessej这很好,但你没有回答我的任何问题。请将所有相关信息添加到原始问题中,不要隐藏在评论中。