【发布时间】:2015-11-24 13:17:04
【问题描述】:
我正在使用 Rails 4 制作一个网络应用程序。
我设置了一个邮件程序来向新用户发送欢迎邮件。
我想将发件人姓名的外观从电子邮件地址更改为“欢迎来到 CF”。
在哪里设置发件人姓名?
class WelcomeMail < ActionMailer::Base
self.delivery_method = :smtp
self.smtp_settings = {
user_name: ENV['GPROD_WELCOME'],
password: ENV['GPwPROD_WELCOME'],
port: 587,
domain: 'cr.com',
address: 'smtp.gmail.com',
authentication: 'plain',
enable_starttls_auto: true
}
def welcome_mail(user)
@user = user
mail(to: user.email, from: "angus@cr.com", subject: "Welcome to Cr, #{user.first_name}")
end
end
更改后,我希望 angus@cr.com 显示为 Welcome to CR。
【问题讨论】:
标签: ruby-on-rails actionmailer