PostMarkAppを使用し、Rails gem ( postmark -rails、 postmark -gem、およびmail ) を利用して、システムのすべての電子メール通知を 1 つの傘の下で取得しようとしています。購入の領収書の送信を処理するメーラーを正常に作成しましたが、パスワードを忘れたという電子メールを受信できませんでした。私の開発ログは、Devise がメッセージを送信したことを示していますが、受信ボックスにメールが受信されず、PostMark クレジットが減少していません。
Devise のメーラーを PostMark アカウント経由で送信するための最良または最も簡単な方法は何ですか?
config/environments/development.rb からのスニペット
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_key => "VALID_API_KEY_WAS_HERE" }
config.postmark_signature = VALID_POSTMARK_SIGNATURE_WAS_HERE
消印を使用するマイ メーラー
class Notifier < ActionMailer::Base
# set some sensible defaults
default :from => MyApp::Application.config.postmark_signature
def receipt_message(order)
@order = order
@billing_address = order.convert_billing_address_to_hash(order.billing_address)
mail(:to => @order.user.email, :subject => "Your Order Receipt", :tag => 'order-receipt', :content_type => "text/html") do |format|
format.html
end
end
end
編集:私の質問に対する解決策は以下です
私のNotifier
メーラーにDevise::Mailerを拡張させ、Deviseを指定してNotifierをメーラーとして使用することで解決しましたconfig/initializers/devise.rb
config/initializers/devise.rb のスニペット
# Configure the class responsible to send e-mails.
config.mailer = "Notifier"
My Notifier メーラー
class Notifier < Devise::Mailer
# set some sensible defaults
default :from => MyApp::Application.config.postmark_signature
# send a receipt of the Member's purchase
def receipt_message(order)
@order = order
@billing_address = order.convert_billing_address_to_hash(order.billing_address)
mail(:to => @order.user.email, :subject => "Your Order Receipt", :tag => 'order-receipt', :content_type => "text/html") do |format|
format.html
end
end
# send password reset instructions
def reset_password_instructions(user)
@resource = user
mail(:to => @resource.email, :subject => "Reset password instructions", :tag => 'password-reset', :content_type => "text/html") do |format|
format.html { render "devise/mailer/reset_password_instructions" }
end
end
end