【发布时间】:2012-10-10 19:39:38
【问题描述】:
我正在尝试将我的应用程序的名称放在 action mailer 发送的电子邮件的主题行中。使用电子邮件地址的默认值执行此操作没有问题,但是当我尝试将其添加到主题时,它会以纯文本 <%= app_name %> 的形式发送。
这是我的邮件/user_mailer.rb:
class UserMailer < ActionMailer::Base
add_template_helper(ApplicationHelper)
extend ApplicationHelper
default from: "#{app_name} <#{system_email}>"
def reset_password_email(user)
@user = user
@url = "#{root_url}/password_resets/#{user.reset_password_token}/edit"
mail(:to => user.email,
:subject => "Reset Your Password | #{app_name}")
end
end
这是我的应用程序助手中的内容:
def app_name
'Tip Share'
end
def app_domain
'tipshare.herokuapp.com'
end
def system_email
'info@wingardcreative.com'
end
#{app_name} 或 <%= app_name %> 都不起作用。我该怎么做?
【问题讨论】:
标签: ruby ruby-on-rails-3 actionmailer