def add_file(values)
      convert_to_multipart unless self.multipart? || Utilities.blank?(self.body.decoded)
      add_multipart_mixed_header
      if values.is_a?(String)
        basename = File.basename(values)
        filedata = File.open(values, 'rb') { |f| f.read }
      else
        basename = values[:filename]
        filedata = values
      end
      self.attachments[basename] = filedata
    end
def add_file(values)
      convert_to_multipart unless self.multipart? || Utilities.blank?(self.body.decoded)
      add_multipart_mixed_header
      if values.is_a?(String)
        basename = File.basename(values)
        filedata = File.open(values, 'rb') { |f| f.read }
      else
        basename = values[:filename]
        filedata = values
      end
      self.attachments[basename] = filedata
    end
Adds a file to the message.  You have two options with this method, you can
 just pass in the absolute path to the file you want and Mail will read the file,
 get the filename from the path you pass in and guess the MIME media type, or you
 can pass in the filename as a string, and pass in the file content as a blob.

 Example:

  m = Mail.new
  m.add_file('/path/to/filename.png')

  m = Mail.new
  m.add_file(:filename => 'filename.png', :content => File.read('/path/to/file.jpg'))

 Note also that if you add a file to an existing message, Mail will convert that message
 to a MIME multipart email, moving whatever plain text body you had into its own text
 plain part.

 Example:

  m = Mail.new do
    body 'this is some text'
  end
  m.multipart? #=> false
  m.add_file('/path/to/filename.png')
  m.multipart? #=> true
  m.parts.first.content_type.content_type #=> 'text/plain'
  m.parts.last.content_type.content_type #=> 'image/png'

 See also #attachments