title: Send Mail with attachment in Rails 3.0 using ActionMailer::Base in one or two lines
body: <p>This is my first quesiton, but what I'm trying to do is send mail with an attachment in rails console, using one or two lines. I dont want to instantiate a class like ..</p>
  
  <p>class Mailer &lt; ActionMailer::Base
  ...
  end</p>
  
  <p>I want to try it this way: </p>
  
  <pre><code>m=ActionMailer::Base.mail(:to =&gt; "harry@example.com", :from =&gt; "test@example.com", :subject=&gt;"test from zip", :content_type=&gt;"multipart/mixed")
  m.attachments['file.zip']={:mime_type =&gt; "application/zip", :data=&gt;File.read("#{Rails.root}/tmp/test.zip")}
  m.deliver
  </code></pre>
  
  <p>This will send an email, but the attachment called noname, which can't be unzipped. It seems that its not parsing the data correctly for the attachment. If I look at the raw email the attachment contents looks something like this:</p>
  
  <pre><code>--
  Date: Tue, 06 Mar 2012 06:59:42 -0800
  Mime-Version: 1.0
  Content-Type: application/zip;
  charset=UTF-8
  Content-Transfer-Encoding: base64
  Content-Disposition: attachment;
  filename=file.zip
  Content-ID: &lt;4f56264f16e82_498a46e93467093@ip-10-125-15-127.mail&gt;
  
  UEsDBBQAAAAIAE9iZUBSMYOwkKgZANRakgAQABUAbG9hbl9kZXRhaWxzLmNz
  dlVUCQADlh9VT0QfVU9VeAQA6APoA8xdW3PiuLZ+37+Ch6ldZ1dZGUvyNW/c
  EwKBQLiENze4gytgZ9tmMplff5YMlgQWmV1tk5qufiAkwV8trcu3bko/8sLa
  m/+p9dmLJPXSfaI1oyR4Df21Non28crPvt+MfS/117Uo5C+9VKu/v8fRH4e3
  O0HobWte9g68gHdaQfJjHyeHb4/9/+79JPu9XbQPU22y2kTRVuv74dqPa7G/
  ...
  </code></pre>
  
  <p>1) is it even possible to send an email with an attachment like this, with out using something like the <a href="https://github.com/benprew/pony" rel="noreferrer">pony</a> gem</p>