title: CSS Images in Email With Rails 3
body: <p>I'm trying to send out an email with Rails 3 and Action Mailer. The email goes out fine, but I want it to be HTML formatted with some basic styling which includes background images. I understand that the images might get blocked until the user allows them to be shown, but I still think it would be best to link to the images on my web server.</p>
  
  <p>The email template called registration_confirmation.html.erb starts out like this:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;style type="text/css"&gt;
  body {
      background: url(/images/mainbg_repeat.jpg) top repeat-x #cfcfcf;
      margin: 0px 0px 0px 0px;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #565656;
  }
  </code></pre>
  
  <p>What is the best way to get the url link for the background image to have the full host included so that the background will show up in the email?</p>