2016-08-03 6 views
0

먼저, AWS Elastic Beanstalk에서 구문 분석 서버를 실행하고 있습니다.구문 분석 서버 메일 메일 어댑터 설치

나는이 비록 나를 위해 충분히 말하지 않는다 readme 파일

##### Email verification and password reset 

Verifying user email addresses and enabling password reset via email requries an email adapter. As part of the `parse-server` package we provide an adapter for sending email through Mailgun. To use it, sign up for Mailgun, and add this to your initialization code: 

```js 
var server = ParseServer({ 
    ...otherOptions, 
    // Enable email verification 
    verifyUserEmails: true, 

    // set preventLoginWithUnverifiedEmail to false to allow user to login without verifying their email 
    // set preventLoginWithUnverifiedEmail to true to prevent user from login if their email is not verified 
    preventLoginWithUnverifiedEmail: false, // defaults to false 

    // 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', 
    } 
    } 
}); 

이 설명서를 참조하십시오. 기존의 익스프레스 웹 사이트를 사용하고 있지 않으며 저장소에 우편 건 코드를 추가 할 위치를 알아야합니다.

나는 이미 mailgun을 가지고 있으며 PHP에서 사용했으며 사용자 암호를 재설정하기 위해 이것을 명시 적으로 사용하고 있습니다.

그래서 다시 구문 분석 서버 폴더의 어떤 파일에 메일 건 어댑터를 추가해야합니까? 이것은 내 파일 구조입니다. 내가 명확하지 않다면 알려주세요 ... enter image description here

이것은 내가 지금까지 추가하고있는 곳입니다. 맞습니까? 내 우편 군중 신분증은 아직 거기에 없지만 그렇게 할 것을 알고 있습니다.

class ParseServer { 

    constructor({ 
    appId = requiredParameter('You must provide an appId!'), 
    masterKey = requiredParameter('You must provide a masterKey!'), 
    appName, 
    filesAdapter, 
    push, 
    loggerAdapter, 
    logsFolder, 
    databaseURI, 
    databaseOptions, 
    databaseAdapter, 
    cloud, 
    collectionPrefix = '', 
    clientKey, 
    javascriptKey, 
    dotNetKey, 
    restAPIKey, 
    webhookKey, 
    fileKey = undefined, 
    facebookAppIds = [], 
    enableAnonymousUsers = true, 
    allowClientClassCreation = true, 
    oauth = {}, 
    serverURL = requiredParameter('You must provide a serverURL!'), 
    maxUploadSize = '20mb', 
    verifyUserEmails = true, 
    preventLoginWithUnverifiedEmail = false, 
    cacheAdapter, 
    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', 
    } 
    }, 
    publicServerURL, 
    customPages = { 
     invalidLink: undefined, 
     verifyEmailSuccess: undefined, 
     choosePassword: undefined, 
     passwordResetSuccess: undefined 
    }, 

답변

1

parse-server에는 기본적으로 mailgun-js 모듈이 포함되어 있으므로 종속성없이 사용할 수 있습니다. 당신이 그것을 사용하기 위해해야 ​​할 것은 다음

  1. 하는
  2. 정확히 그것은 당신이 제공 한 코드에 포함하는 방법을 같이 메일 건 간단한 어댑터를 포함 거기에서 apiKey에를 mailgun 계정을 만들고 얻을 관련 값으로 값을 변경하십시오.

위의 추가 어댑터는 전자 메일 확인 및 암호 재설정 전용입니다. 전자 메일 (예 : 마케팅 이메일, 참여 등)을 보내려면 클라우드 코드 기능을 만들 수 있어야합니다. mailgun-js 모듈을 필요로하고 mailgun-js 모듈을 사용하여 정확히 어떻게 이메일을 보내야합니까? here 클라이언트 코드에서이 클라우드 코드 기능을 트리거해야하며 이메일이 전송됩니다.

+0

어디에서 해당 코드를 포함합니까? 그것이 내가 정말로 혼란스러워하는 전부입니다. –

+0

내 질문에 코드를 추가 할 위치에 코드를 추가했습니다. –

+0

어떻게 parse-server를 example에서 사용하기 시작 했습니까? 아니면 parse-server를 다운로드하여 압축 해제 했습니까? –

관련 문제