如何实现phpjs邮件功能?
这有点难以解释,所以请耐心等待......
这是我的代码:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="mail.js"></script>
<script type="text/javascript">
$(function() {
$( "#target" ).submit(function(e) {
e.preventDefault();
var email = $(this).data('email');
var to = $( "input[name=myEmail]" ).val();
var subject = $( "input[name=mySubject]" ).val();
var message = $( "textarea[name=myMessage]" ).val();
var headers = 'From: '+email;
var test = mail(to, subject, message, headers);
console.log(test);
});
});
</script>
<form id="target" method="post" data-email="admin@website.com">
Email<br />
<input type="TEXT" name="myEmail" value=""/><br />
Subject<br />
<input type="TEXT" name="mySubject" value=""/><br />
Message<br />
<textarea name="myMessage"></textarea>
<input type="SUBMIT" value="Send">
</form>
但结果总是错误的。怎么了?