How can we set the name of the email sender in Rails Mailer?

THpubs picture THpubs · Dec 28, 2013 · Viewed 17.8k times · Source

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?

Answer

membLoper picture membLoper · Dec 28, 2013

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