【问题标题】:Setting up shoppe-notification-emails gem设置 shoppe-notification-emails gem
【发布时间】:2015-07-16 00:13:31
【问题描述】:

我希望将 shoppe-notification-emails gem (https://github.com/danquinney/notification-emails) 添加到我的 Shoppe 项目中(使用:https://github.com/tryshoppe/shoppe)。

我做了标准的 gemfile mods,然后运行 ​​bundle install,它似乎工作正常。但是,当我尝试在 Rails 控制台(Shoppe::NotificationMailer.order_received(order).deliver)中手动调用通知电子邮件时,它会显示“未初始化的常量 Shoppe::NotificationMailer”。这让我相信通知邮件引擎没有正确添加到我的项目中。 notification-emails 项目的 github 页面实际上并没有任何额外的设置信息,有人在这里有任何见解吗?

【问题讨论】:

    标签: ruby ruby-on-rails-4 rails-engines


    【解决方案1】:

    Shoppe 实际上附带了一个内置邮件程序。确保您在 production.rb 和 development.rb 中都设置了邮件程序

    然后确保在应用程序的 /shoppe/settings 页面上设置了您的邮件。

    您的 .rb 文件应如下所示:

    config.action_mailer.delivery_method = :smtp
      config.action_mailer.smtp_settings = {
          :address              => "smtp.gmail.com",
          :port                 => 587,
          :user_name            => ENV['USERNAME'],
          :password             => ENV['PASSWORD'],
          :authentication       => "plain",
          :enable_starttls_auto => true
      }
    

    根据需要替换字段,尽管上面是为 gmail 设置的,您只需要替换 USERNAME 和 PASSWORD 字段。

    【讨论】:

      猜你喜欢
      • 2015-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-09
      • 2011-10-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多