【发布时间】:2018-07-19 11:06:09
【问题描述】:
我正在尝试通过 javascript API 通过静态网站发送电子邮件。目前,我可以通过邮寄请求发送电子邮件。单击发送电子邮件按钮后,我将被重定向到该特定 API 链接。 我需要帮助重定向到我的自定义链接,并在后端发送电子邮件。
<html>
<script>
function email()
{
$.ajax({
type:"POST",
url:"https://formspree.io/MYEMAIL@SOMEMAIL.COM",
contentType:"application/json; charset=utf-8",
dataType:"json",
success:function(result){
alert(result.d);
console.log(result);
}
});
Location.href = "https://google.com";
}
</script>
<body>
<textarea name="message" placeholder="Your message"></textarea>
<button type="submit">Send</button>
</body>
</html>
【问题讨论】:
标签: javascript html-email