Neu: udemy Kurs Ruby für Anfänger von Stefan Wintermeyerdiv class="para">HTML-E-Mails zu erstellen, ist denkbar einfach. Erstellen Sie bitte die Datei app/views/user_mailer/new_account_email.html.erb mit folgendem Inhalt:
<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
    <p>Hello <%= @user.name %>,</p>

    <p>your new account is active.</p>

    <p><i>Have a great day!</i></p>
    <p>A Robot</p>
  </body>
</html>

Wenn Sie jetzt einen User anlegen, sehen Sie in der Log-Datei log/development.log was gerendert wurde und die versendete E-Mail:
  Rendered notification/new_account.html.erb (2.0ms)
  Rendered notification/new_account.text.erb (0.4ms)

Sent mail to stefan.wintermeyer@amooma.de (69ms)
Date: Wed, 30 May 2012 17:46:49 +0200
From: from@example.com
To: stefan.wintermeyer@amooma.de
Message-ID: <4fc640e930bff_aa173fd61d828ce0501e4@MacBook.local.mail>
Subject: The new account Wintermeyer is active.
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_4fc640e921794_aa173fd61d828ce04987d";
 charset=UTF-8
Content-Transfer-Encoding: 7bit



----==_mimepart_4fc640e921794_aa173fd61d828ce04987d
Date: Wed, 30 May 2012 17:46:49 +0200
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <4fc640e926312_aa173fd61d828ce04998e@MacBook.local.mail>

Hello Wintermeyer,

your new account is active.

Have a great day!
  A Robot

----==_mimepart_4fc640e921794_aa173fd61d828ce04987d
Date: Wed, 30 May 2012 17:46:49 +0200
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <4fc640e928055_aa173fd61d828ce0500ea@MacBook.local.mail>

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
  	<p>Hello Wintermeyer,</p>

    <p>your new account is active.</p>

    <p><i>Have a great day!</i></p>
    <p>A Robot</p>
  </body>
</html>

----==_mimepart_4fc640e921794_aa173fd61d828ce04987d--
Rails hat automatisch eine E-Mail im MIME-Format multipart/alternative generiert, da der View sowohl im Format html.erb als auch text.erb vorhanden war.

Autor

Stefan Wintermeyer