发邮件不发邮件 [英] send mail form not sending mail
本文介绍了发邮件不发邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户点击链接时,我会弹出一个表单,然后发送电子邮件到他们选择的地址。表单看起来不错,但电子邮件没有被发送...
I have a form that pops up when the user clicks a link and then sends an email to the address of their choice. The form looks great, but the email isn't getting sent...
<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:
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>
是的,我是这里的新手。感谢您的帮助和耐心。
Yeah, I'm a novice here. Thanks for your help and patience.
推荐答案
您需要一些服务器端代码才能发送邮件。只需一张表单就不会为你做任何事情
You need some server side code to send the mail. Just having a form doesn't do anything for you
所以要发送一下:
$('#sendMessage').click(function(e) {
var $form = $('#tellafriend_form');
$.post($form.get(0).action, $form.serialize(), function(data){
//something on success
})
$("#tellfriend").fadeToggle('fast');
});
这篇关于发邮件不发邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文