Rails 3.2:Devise:Email Name

Rails 3.2:Devise:Email Name

问题描述:

我有一个Rails 3.2应用程序,它使用Devise进行身份验证。Rails 3.2:Devise:Email Name

我想要注册的确认电子邮件将“Foo Signups”作为电子邮件地址,“[email protected]”作为电子邮件地址。现在,我只有“[email protected]”作为from:电子邮件地址。

我的配置是这样的:

# in the file config/initializers/devise.rb 
Devise.setup do |config| 
    config.mailer_sender="[email protected]" 

# etc... 

# in the file config/environments/development.rb 
config.action_mailer.smtp_settings = { 
    address: "smtp.gmail.com", 
    port: 587, 
    authentication: "plain", 
    enable_starttls_auto: true, 
    user_name: ENV["GMAIL_ADDRESS"], 
    password: ENV["GMAIL_PASSWORD"] 
} 

其中GMAIL_ADDRESS和GMAIL_PASSWORD是我的Gmail用户名和密码作为环境变量和[email protected]不同。

如何配置SMTP或设计为将“Foo Signups”作为电子邮件地址,“[email protected]”作为电子邮件地址?

用的ActionMailer你可以设置你从类似"#{@user.name} <#{@user.email}>"

电子邮件地址我还没有想出试过,但我认为同样的思维过程会为配置工作,因为我相信这只是发送的是参考ActionMailer:

Devise.setup do |config| 
    config.mailer_sender= "Foo Signups <[email protected]>" 
    #... 
end