parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Request Password Reset not sending mail

Open adamofsky opened this issue 9 years ago • 5 comments

Hello guys 2 days I trying to resolve this problem by searching for solutions but no success

var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'myAppId', verifyUserEmails: false, //depends on your needs, you can set it to false emailVerifyTokenValidityDuration: 2 * 60 * 60, // in seconds (2 hours = 7200 seconds) preventLoginWithUnverifiedEmail: false, // defaults to false

publicServerURL: 'https://a.herokuapp.com/parse', // Your apps name. This will appear in the subject and body of the emails that are sent. appName: 'App', // The email adapter emailAdapter: { module: 'parse-server-simple-mailgun-adapter', options: { // The address that your emails come from fromAddress: '[email protected]', // Your domain from mailgun.com domain: 'https://api.mailgun.net/v2/mg.a.com/messages', // Your API key from mailgun.com apiKey: 'key-aaaaaaaaaaaaaaaaaaaaaaa' } },

The server works perfectly(all data loaded as well) Mailgun works perfectly(sending emails from terminal like a charm) When I try to reset password I have in log:

2017-07-17T22:20:06.550173+00:00 heroku[router]: at=info method=POST path="/parse/requestPasswordReset" host=a.herokuapp.com request_id=ff60cd44-6557-464c-9f17-aaaaaaaaa fwd="12.345.678.90" dyno=web.1 connect=1ms service=77ms status=200 bytes=483 protocol=https

And nothing happen

If I will remove the appName I will see in the log: An appName, publicServerURL, and emailAdapter are required for password reset functionality.' } code=1, message=An appName, publicServerURL, and emailAdapter are required for password reset functionality.

If I will request reset for wrong user I will see in the log:

2017-07-17T22:27:23.340663+00:00 app[web.1]: message: 'No user found with email [email protected].' } code=205, message=No user found with email [email protected]. 2017-07-17T22:27:23.349814+00:00 app[web.1]: [object Object]

It is mean that everything is worked BUT IT IS NOT SENDING AN EMAIL

Thanks for any response.

adamofsky avatar Jul 18 '17 21:07 adamofsky

@adamofsky any chance this is solved? We have extensive testing around the email sending, and I'm not sure where it doesn't work.

flovilmart avatar Oct 23 '17 03:10 flovilmart

also, can you provide the logs when running with VERBOSE=1 this will help.

flovilmart avatar Oct 23 '17 03:10 flovilmart

Hi, is this problem solved? I have pretty much the same problem. Still can't figure out what's going on.

chao-li avatar Jun 11 '18 13:06 chao-li

Closing due to lack of activity

flovilmart avatar Jun 11 '18 13:06 flovilmart

Hi. I have exactly the same problem and I can not seem to find a solution. I have set up my Parse server (v3.1.2) on Elastic Beanstalk and everything is working well. I have set up "reset email" and "verify email" using my Mailgun account and the parse-server-mailgun module. My "verify email" works correctly and an email is sent to the user but I can not get my "reset password" to function. I expect there is a parameter I am missing in my index.js file but I can't see what it can be. Given that the "verify email" correctly sends the link that verifies the account it must be something specific to the "reset password" options. I have googled this extensively without finding what the problem is.

The verbose log after sending a request for "reset password" does not offer any information and looks like this (seems correct):

 [36mverbose[39m: REQUEST for [POST] /parse/requestPasswordReset: {
   "email": "me@<removed>"
   } method=POST, url=/parse/requestPasswordReset, host=<removed>.com, 
   x-real-ip=<removed>, x-forwarded-for=<removed>, <removed>, content- 
   length=35, accept=*/*, accept-encoding=br, gzip, deflate, accept- 
   language=en-us, content-type=application/json; charset=utf-8, user- 
   agent=<removed>/299 CFNetwork/975.0.3 Darwin/18.2.0 (x86_64), x- 
   parse-app-build-version=299, x-parse-app-display-version=1.0.0, x- 
   parse-application-id=<removed>, x-parse-client-key=<removed>, x- 
   parse-client-version=osx1.17.2, x-parse-installation-id=<removed>, 
   x-parse-os-version=10.14.1 (18B75), x-forwarded-port=443, x- 
   forwarded-proto=https, email=me@<removed>
   [36mverbose[39m: RESPONSE from [POST] /parse/requestPasswordReset: {
   "response": {}}

My index.js file for my server looks like this for the email settings:

 ....
  databaseURI: databaseUri,
  cacheAdapter: redisCache,
  cloud: path.join(__dirname + '/cloud/main.js'),
  appId: process.env.APP_ID,
  masterKey: process.env.MASTER_KEY,
  serverURL: process.env.SERVER_URL,
  allowClientClassCreation: false,
  maxUploadSize: '10mb',
  jsonLogs: true,
  logsFolder: path.join(__dirname+'/logs'),
  sessionLength: 31536000, // 1 year in seconds
  expireInactiveSessions: true,
  verbose: process.env.VERBOSE,  
  revokeSessionOnPasswordReset: true,
  expireInactiveSessions: true,
  enableAnonymousUsers: process.env.ENABLE_ANONYMOUS_USERS,
  publicServerURL: process.env.PUBLIC_SERVER_URL,
  appName: 'Syncsolution',
  schemaCacheTTL: 5000,
  verifyUserEmails: process.env.VERIFY_USER_EMAIL,
  emailVerifyTokenValidityDuration: 43200,
  emailAdapter: {
     module: 'parse-server-mailgun',
     options: {
         fromAddress: process.env.DEFAULT_FROM_ADDRESS
    domain: process.env.MAILGUN_DOMAIN
    host:'api.mailgun.net',
    apiKey: process.env.MAILGUN_API_KEY
    templates: {
        passwordResetEmail: {
            subject: 'Reset your password',
            pathPlainText: path.join(__dirname+'/public/assets/HTML/password_reset.text'),
            pathHtml: path.join(__dirname+'/public/assets/HTML/password_reset.html'),
            callback: (user) => {
                return {
                    firstName: user.get('firstName')
                }
            }
        },
        verificationEmail: {
            subject: 'Confirm your account',
            pathPlainText: path.join(__dirname+'/public/assets/HTML/email_verify.text'),
            pathHtml: path.join(__dirname+'/public/assets/HTML/email_verify.html'),
            callback: (user) => {
                return {
                    firstName: user.get('firstName')
                     }
                 }
             }
         }
     }
  },

Any insight as to what may be the problem or what I may be lacking would be appreciated. Thank You. Cheers, Trond

trondkr avatar Dec 11 '18 04:12 trondkr