0

我无法获得邮戳来处理注册并忘记密码电子邮件:

user_mailer.rb

class UserMailer < ActionMailer::Base
  include Devise::Mailers::Helpers

  default from: "donotreply@barnpix.com"

  def confirmation_instructions(record)
    devise_mail(record, :confirmation_instructions)
  end

  def reset_password_instructions(record)
    devise_mail(record, :reset_password_instructions)
  end

  def unlock_instructions(record)
    devise_mail(record, :unlock_instructions)
  end

  # you can then put any of your own methods here
end

应用程序.rb

config.action_mailer.delivery_method   = :postmark
    config.action_mailer.postmark_settings = { :api_key => ENV['9302106a-63xxxx-xxx-xx-'] }

用户.rb

devise :database_authenticatable, :registerable, :recoverable,
         :rememberable, :trackable, :validatable

设计.rb

config.mailer = "UserMailer" # UserMailer is my mailer class

我根本无法让它工作。关于我可能做错了什么或我可能缺少什么以使其正常工作的任何提示?

4

1 回答 1

1

I think your problem is caused by this line:

config.action_mailer.postmark_settings = { :api_key => ENV['9302106a-63xxxx-xxx-xx-'] }

ENV is a hash of all environment variables. You should use names to access the values. I guess you’re using Postmark on Heroku, so it will be ENV['POSTMARK_API_KEY'] in that case.

于 2013-09-26T14:05:31.663 回答