Reputation: 8162
Whenever I send an email through my Rails app, in my inbox, the name of the sender is shown as "admin".. The email is admin@... The first part of the domain is shown. Im using Mandrill to send the email. How can I change this name?
Upvotes: 50
Views: 24323
Reputation: 518
I've used this solution from the ActionMailer guide and it works perfectly.
class AdminMailer < ApplicationMailer
default from: email_address_with_name('[email protected]', 'Admin Name')
end
Upvotes: 7
Reputation: 2002
If you're using ActionMailer, try below
mail(
from: 'Sender Name <[email protected]>',
to: 'Receiver Name <[email protected]>',
subject: 'Subject'
)
If you're using the Mandrill API, you can explicitly set the sender name API call payload
Upvotes: 100
Reputation: 201
This work for me(Rails):
default(
from: "SenderName <[email protected]>",
reply_to: "SenderName <[email protected]>"
)
def send_mail(email, subject)
#body = ......
mail(to: email, subject: subject, body: body, content_type: "text/html")
end
Upvotes: 20