您设置了电子邮件适配器吗?
看一眼 :https://github.com/ParsePlatform/parse-server
电子邮件验证和密码重置
验证用户电子邮件地址并通过电子邮件启用密码重置需要电子邮件适配器。作为解析服务器包的一部分,我们提供了一个用于通过 Mailgun 发送电子邮件的适配器。要使用它,请注册 Mailgun,并将其添加到您的初始化代码中:
var server = ParseServer({
...otherOptions,
// Enable email verification
verifyUserEmails: true,
// The public URL of your app.
// This will appear in the link that is used to verify email addresses and reset passwords.
// Set the mount path as it is in serverURL
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse 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: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
});
您还可以使用社区贡献的其他电子邮件适配器,例如 parse-server-sendgrid-adapter 或 parse-server-mandrill-adapter。
将其添加到解析服务器的实例化中,如果您从 git 下载解析服务器,它最初看起来如下所示。
var api = new ParseServer({
serverURL: process.env.SERVER_URL,
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '' //Add your master key here. Keep it secret!
});
因此,将第一个代码片段附加到上述示例的底部。
var api = new ParseServer({
serverURL: process.env.SERVER_URL,
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
verifyUserEmails: true,
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse 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: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
});