From db8b3e71dc30e326a665f3b9d5c70473b8f08fa4 Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Sat, 25 Sep 2010 14:49:28 +0530 Subject: add section about email with name --- railties/guides/source/action_mailer_basics.textile | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'railties/guides/source') 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 +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 "Name <email>". + + + 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 + h4. Mailer Views -- cgit v1.2.3