Reputation: 2685
I am using Rails 4 to make a web app.
I have a mailer set up to send a welcome mailer to new users.
I want to change the appearance of the sender name from the email address to "Welcome to CF".
Where to I set the name of the sender?
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: "[email protected]", subject: "Welcome to Cr, #{user.first_name}")
end
end
When it's changed, I want [email protected] to appear as Welcome to CR.
Upvotes: 4
Views: 2079
Reputation: 222
is it possible keep, user.email at from ,means to the admin he can know mail was recieved from particular user
from: user.email
Upvotes: 0
Reputation: 2285
Change the value of from within your mail params:
from: "Angus <[email protected]>"
The text before the <> will be displayed as the from name.
Upvotes: 9