在我的动作邮件中,我不确定我应该如何在电子邮件正文中呈现我的views/app_mailer/sample_email.html.erb
模板...
class AppMailer < ActionMailer::Base
def sample_email(user)
@user = user
mg_client = Mailgun::Client.new ENV["api_key"]
message_params = {:from => ENV["username"],
:to => @user.email,
:subject => "Welcome, #{@user.name}!",
:html => "<%= render 'sample_email' %>"}
mg_client.send_message ENV["domain"], message_params
end
end
我浏览了How to render rails mailer views in Mailgun HTTP API,但我无法让它发挥作用。我正在使用mailgun-ruby
gem(以及premailer-rails
gem,但这可能不适用于此问题。)
非常感谢任何帮助!