我最近开始使用Mandrill进行客户端电子邮件发送。客户端的网站不使用任何服务器端程序,因此每个逻辑都必须位于客户端。如何从客户端使用Mandrillapp API?
我现在是工作在Chrome,火狐,IE10,但不是在LTE IE9,也不是Android 4.0 <既不IOS:\
m = new mandrill.Mandrill("APIKEY", true)
m.call "messages/send", {
message:
html: createHtml()
subject: "subj"
from_email: "[email protected]",
from_name: "From",
to: [
email: "[email protected]"
name: "User"
]
}, (()->
console.log "success"
@
),()->
console.log "error"
@
在这段代码中,我使用JS Mandrill API wrapper,但我用jQuery ajax POST-ing试了一下,我得到了同样的结果。
jQuery的版本:
$.ajax
type: "POST"
url: "https://mandrillapp.com/api/1.0/messages/send.json"
data:
key: "APIKEY"
message:
html: createHtml()
subject: "subject"
from_email: "[email protected]",
from_name: "From",
to: [
email: "[email protected]"
name: "User"
]
谁能帮我出,如何解决跨域API调用来山魈?
谢谢,稍后当我回家时我会检查它:) Btw。我使用jQuery 1.10.2,所以这不应该是一个问题。使用Mandrill,您可以指定要允许电子邮件发送的IP,因此“黑客”只能从同一个站点使用它 – seniorpreacher