Parse-Server-Mailgun:如何编辑模板并将它们推送到服务器

时间:2017-02-07 21:15:21

标签: heroku parse-platform parse-server mailgun

这是我上一个问题的扩展:

Setup mailgun with parse-server on Heroku

运行' $ npm install parse-server-mailgun'它在我当前的目录中安装了一堆目录和文件。但是,当我编辑其中任何一个,特别是电子邮件模板,或者我的parse-server-example文件夹的主根目录中不存在的任何内容时,他们都不会推送到Heroku。

我假设,如果是这种情况,它必须只是推动位于根目录中的主配置文件,然后从某个地方从nom中拉出其余部分?

如何将整个目录及其所有子文件夹/文件推送到我的Heroku服务器?或者编辑服务器上已有的电子邮件模板?

对不起,这可能是一个愚蠢的问题。

3 个答案:

答案 0 :(得分:0)

简单修复。将它们放在构建的根目录中。它们将自动提交给服务器

答案 1 :(得分:0)

您不应该从包的文件夹中修改模板。而是在项目的目录中创建自己的模板,然后在初始化ParseServer时引用它们。然后只需将这些新文件添加到您的git存储库中,它们就可以在服务器上使用。

例如:

emailAdapter: {
    module: 'parse-server-mailgun',
    options: {
        // The address that your emails come from
        fromAddress: 'Hello <hello@example.com>',
        // Your domain from mailgun.com
        domain: config.Mailgun.domain,
        // Your API key from mailgun.com
        apiKey: config.Mailgun.api,
        templates: {
            verificationEmail: {
                subject: 'Please verify your e-mail for Example.com',
                pathPlainText: './email/emailVerification/index.txt',
                pathHtml: './email/emailVerification/index.html',
                callback: function (user) { return { firstName: user.get('firstName') }; }
                // Now you can use {{firstName}} in your templates
            }
        }
    }
}

答案 2 :(得分:0)

您可以轻松使用此mail adapter,也可以将其用于多语言邮件。

希望可以为您提供帮助。 ??

有关如何使用它的小例子。

emailAdapter: {
  module: 'parse-smtp-template',
  options: {
    ...
    template: true,
    templatePath: "views/templates/template.html",

    // Custome options to your emails
    // You can add more options if you need
    passwordOptions: {
        subject: "Password recovery",
        body: "Custome pasword recovery email body",
        btn: "Recover your password"
        /* --EXTRA PARAMETERS--
        others: {
          extraParameter
        }
        */
    },
    confirmOptions: {
        subject: "E-mail confirmation",
        body: "Custome email confirmation body",
        btn: "confirm your email"
    },
  }
}

https://github.com/macarthuror/parse-smtp-template