ActionMailer Examples: Responses, Welcome Greetings, Sendmail, Templating and Performance

Using Rails ActionMailer The Right Way

By providing the full name in the @from field, you avoid having emails say they were sent from congratulations:

def new_registration(user)
@subject = ‘Welcome!’
@recipients =
@from = ‘Ruby on Rails Blog <>’
@body[”user”] = user

Now the email will show that it’s from Ruby an Rails Blog. This passed some simple tests with yahoo and gmail with no messages being sent to the spam folder. Everything comes through perfectly.