aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorAditya Sanghi <asanghi@me.com>2010-09-25 14:49:28 +0530
committerAditya Sanghi <asanghi@me.com>2010-09-25 14:49:28 +0530
commitdb8b3e71dc30e326a665f3b9d5c70473b8f08fa4 (patch)
tree4bf4dfd33612ddaa85c4766d6f7d0766558a6fe0 /railties/guides/source
parentc94e92e2b080ef824bc63dae771173fd4f57e28e (diff)
downloadrails-db8b3e71dc30e326a665f3b9d5c70473b8f08fa4.tar.gz
rails-db8b3e71dc30e326a665f3b9d5c70473b8f08fa4.tar.bz2
rails-db8b3e71dc30e326a665f3b9d5c70473b8f08fa4.zip
add section about email with name
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/action_mailer_basics.textile13
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/guides/source/action_mailer_basics.textile b/railties/guides/source/action_mailer_basics.textile
index 16e611f285..35372d5429 100644
--- a/railties/guides/source/action_mailer_basics.textile
+++ b/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