如何在ActionMailer中使用名称? [Rails 2.3.5]

时间:2010-04-30 17:41:19

标签: ruby-on-rails actionmailer

我想在电子邮件客户端中显示一个漂亮的名字

1 个答案:

答案 0 :(得分:1)

这应该可以解决问题!

class UserMailer < ActionMailer::Base
  def welcome_email(user)
    recipients    user.email

    # PRETTY NAMES
    from          "Prettiest Pony <prettypony@imaginarium.tld>"

    subject       "Welcome to My Awesome Site"
    sent_on       Time.now
    body          {:user => user, :url => "http://example.com/login"}
  end
end

有关详细信息,请参阅ActionMailer basics