1.通过 formspree
网站地址: https://formspree.io/
需要注册一个账户,选择free免费版,new form 可以设置安全域名,等配置
js代码
1.走表单
<form
action="https://formspree.io/xqkevnyb"
method="POST"
>
<label>
Your email:
<input type="text" name="_replyto">
</label>
<label>
Your message:
<textarea name="message"></textarea>
</label>
<!-- your other form fields go here -->
<button type="submit">Send</button>
</form>
2.ajax
$.ajax({
type: "post", //必须post请求
url: "https://formspree.io/xqkevnyb", //abc@qq.com换成你要接收的邮箱地址
async: true,
data: values,
dataType: "json",
success: res => {
alert('提交成功,请您耐心等待'); //发送成功后的操作
},
error: res => {
alert("未知错误,发送失败,请您稍后重试。。。。。");
}
});