2016-05-08 7 views
1

私はParse Server Simple Mailgun Adapterを使用しています。私のParse ServerはHeroku上で完全に動作しています。私はNode.jsのとExpressに新しいですが、私は経由解析サーバーのルートにアダプターをインストール:Parse Server Simple Mailgun Adapter 'verifyUserEmails'問題

npm i parse-server-simple-mailgun-adapter 

これはnode_modulesフォルダを作成し、基本的にMailgunアダプタ用のGitHubリポジトリをクローン化しました。 verifyUserEmailsキーをコメントアウトするときにサーバーが完全に動作し

var api = new ParseServer({ 
    verifyUserEmails: true, 
    databaseURI: databaseUri || 'mongodb://DATABASE', 
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', 
    appId: process.env.APP_ID || 'APPID', 
    masterKey: process.env.MASTER_KEY || 'MASTERKEY', //Add your master key here. Keep it secret! 
    serverURL: process.env.SERVER_URL || 'https://SERVER/parse', // Don't forget to change to https if needed 
    publicServerURL: 'https://SERVER/parse', 
    fileKey: process.env.FILE_KEY || 'FILEKEY', 
    push: { 
    ios: [ 
     { 
     pfx: 'FILE.p12', // Dev PFX or P12 
     bundleId: 'BUNDLE', 
     production: false // Dev 
     }, 
     { 
     pfx: 'FILE.p12', // Prod PFX or P12 
     bundleId: 'BUNDLE', 
     production: true // Prod 
     } 
    ] 
    }, 
    emailAdapter: { 
    module: 'parse-server-simple-mailgun-adapter', 
    options: { 
     fromAddress: '[email protected]', 
     domain: 'DOMAIN', 
     apiKey: 'KEY', 
    } 
    }, 
    liveQuery: { 
    classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions 
    } 
}); 

:のように私のindex.js解析サーバの構成が見えます。それによって、サーバーは動作しません。 Mailgunアダプターは、関係なく動作しません。どんな助けでも大歓迎です。ありがとう!

答えて

4

電子メールアダプターをセットアップしましたか?

を見てみましょう:

は、ユーザーの電子メールアドレスを確認し、電子メールを介してパスワードのリセットを有効にリセットhttps://github.com/ParsePlatform/parse-server

メールの確認やパスワードをメールアダプタをrequries。解析サーバパッケージの一環として、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', 
    } 
    } 
}); 

ます。また、このような構文解析サーバsendgrid・アダプタまたはパース・サーバー・マンドリルなどのコミュニティによって寄与他の電子メール・アダプターを使用することができます。これを使用するには、Mailgunにサインアップして、あなたの初期化コードにこれを追加-アダプタ。

OR

クラウドコードで独自に作成 https://www.npmjs.com/package/mailgun-js

var api_key = '[SECRET_API_KEY]'; 
var domain = '[DOMAIN_HERE]'; 
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain}); 

Parse.Cloud.define('testemail', function(req, res) { 
    var data = { 
    from: 'Excited User <[email protected]>', 
    to: '[email protected]', 
    subject: 'Hello', 
    text: 'Testing some Mailgun awesomness!' 
    }; 

    mailgun.messages().send(data, function (error, body) { 
    console.log(body); 
    }); 

    res.success('Email Sent!'); 
}); 
+0

mailgun-JSを使用して、問題はそれだけで、それが動作するために確認した後に時間がかかったということでした。私の元のメッセージのコードは後で試してみた。 – user2287517

関連する問題