简体   繁体   中英

Unable to display username in emails with action mailer

I am trying to do something extremely simple, which is display username on the registration email. However it's outputting a blank space instead of displaying the user. I have just setup ActionMailer and everything else I have done works fine.

Code from register template:

<%= @user.name %>,

Thank you for registering!

Code from user_mailer.rb:

  def registration_confirmation(user)
    @user = user
    mail(:to => user.email, :subject => "Registered")
  end

在尝试这样的事情:

mail(:to => "#{user.name}<#{user.email}>", :subject => "Registered")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM