Setting the Name in From Emails in Ruby on Rails

Sending emails in Ruby on Rails is pretty simple and it is something that we often do not give much thought about if the emails are received. However, attention to detail is important.

I too fell into this trap where I never took notice to the Name that was being displayed on emails that were being generated. Looking back, the name on each of the email addresses were showing up as support.

I started to investigate where this mixup was. I tried manually sending the email from my mail client and it came through properly. Since the emails are being sent through Amazon SES, I looked in there since I had initially verified the email address through there.

This led me to look into my application to see where I could potentially fix this.

Within the ApplicationMailer file app/mailers/application_mailer.rb we can set the default from email address and originally my file looked like this

The fix ended up being really simple. I changed the default from: to

and deployed the code.

This display name format 'descriptive name <email address>' is pretty common and widely accepted.

The problem was fixed. Take a moment and check your mailers and make sure that they are sending with a descriptive name.