Use Mailgun API in Password Recovery Script
I'm trying to use the Mailgun API in the Password Recovery script in the tutorial instead of Sendgrid. However, I am unable to send the email successfully from the script. I do not get an error message and code: 0. Below is the code I'm using to send the email. I included my api key in the post url instead of the parameters.
if (XHRResponse.status == 200 && email) {
var XHRResponse = XHR.send("POST", "https://api:key-"api-key"@api.mailgun...", {
"parameters": {
"to": email,
"toname": "",
"subject": "Password Recovery",
"text": "Your recovery code is: " + secretCode + ". Copy and this code into the field provided.",
"from": "mailgun@"domain".mailgun.org"
}
});
Thank you for your help.