Reset password issue with Heroku and Mailgun

Hello,

I am running a parse server on Heroku, and it’s been working fine.
However, now I am struggling to make the “password reset” function work with Mailgun. (For now, I just only need the password reset, but not email verification)

I read the instruction from below:

I installed a simple mailgun adapter on my local example parse server folder with

npm install --save @parse/simple-mailgun-adapter

Now I can see it’s included in package.json


$ more package.json
{
“name”: “parse-server-example”,
“version”: “1.4.0”,

},
“license”: “MIT”,
“dependencies”: {
@parse/simple-mailgun-adapter”: “^1.0.3”,
“express”: “~4.11.x”,
“kerberos”: “~0.0.x”,
“parse”: “~1.8.0”,
“parse-server”: “*”
},
“scripts”: {
“start”: “node index.js”
},
“engines”: {
“node”: “>=4.3”
}
}


After that, I run a python script below (indicated in the Mailgun site) to check my “domain”, “from” and “api”.

def send_simple_message():
return requests.post(
https://api.mailgun.net/v3/MY_DOMAIN_NAME/messages”,
auth=(“api”, “MY_API_KEY”),
data={“from”: “Excited User <[email protected]_DOMAIN_NAME>”,
“to”: [“[email protected]_DOMAIN_NAME”],
“subject”: “Hello”,
“text”: “Testing some Mailgun awesomness!”})

This seems to work fine that I can send and receive emails through Mailgun this way.


Now, I implemented these parameters (domain, fromAddress, apiKey) on my index.js and pushed with git as usual.

var api = new ParseServer({

publicServerURL: ( I set this as same as my “serverURL”)

appName: ‘MyAppName’,
emailAdapter: { module: ‘@parse/simple-mailgun-adapter’,
options: {
Address: ‘[email protected]_DOMAIN_NAME’,
domain: ‘MY_DOMAIN_NAME’,
apiKey: ‘MY_API_KEY’
}
}
});

When I run the app and tap the “forgot password” button, the prompt appears asking to input the email address. After inputting the email address, it says “Password Reset An email with reset instructions has been sent to [email protected]
However, it doesn’t send anything and Mailgun does not show any record of that either.

Does anyone know what might be the cause of this problem?

Thanks a lot!
Sumire

Hello,

If you are using a sandbox domain in mailgun then you need to add your test e-mail to sandbox’s test list.

As mailgun says

Sandbox domains are restricted to authorized recipients only.

Hello,

Thank you for your reply. I already encountered this also, so I added some test email addresses to the authorized recipient’s list as you suggest, and it worked fine. Now I am working with my subdomain as suggested by Mailgun (I confirmed that the subdomain is already propagated), and the testing with python code is working fine (as shown in my previous message). However, it doesn’t work through a parse server on heroku when I submit “forgot password” request through my app. Mailgun doesn’t send any password reset email for this.

ok, now the problem solved. I learned that we have to add a “host” name for the EU region for the mailgun adaptor (the default is the U.S. region).