Permalink
Browse files

add section about email with name

  • Loading branch information...
1 parent c94e92e commit db8b3e71dc30e326a665f3b9d5c70473b8f08fa4 Aditya Sanghi committed Sep 25, 2010
Showing with 13 additions and 0 deletions.
  1. +13 −0 railties/guides/source/action_mailer_basics.textile
@@ -258,6 +258,19 @@ It is possible to send email to one or more recipients in one email (for e.g. in
end
</ruby>
+h5. Sending email with names
+
+Sometimes you wish to show the name of the person instead of just their email address when they receive the email. The trick to doing that is
+to format the email address in the format <tt>"Name &lt;email&gt;"</tt>.
+
+<ruby>
+ def welcome_email(user)
+ @user = user
+ email_with_name = "#{@user.name} <#{@user.email}>"
+ mail(:to => email_with_name,
+ :subject => "Welcome to My Awesome Site")
+ end
+</ruby>
h4. Mailer Views

0 comments on commit db8b3e7

Please sign in to comment.