public Method

Mail.attachments

There's no documentation for this item.

Source Code

# File action_mailer/vendor/tmail-1.2.2/tmail/attachments.rb, line 24
def attachments
  if multipart?
    parts.collect { |part| 
      if part.multipart?
        part.attachments
      elsif attachment?(part)
        content   = part.body # unquoted automatically by TMail#body
        file_name = (part['content-location'] &&
                      part['content-location'].body) ||
                    part.sub_header("content-type", "name") ||
                    part.sub_header("content-disposition", "filename")

        next if file_name.blank? || content.blank?

        attachment = Attachment.new(content)
        attachment.original_filename = file_name.strip
        attachment.content_type = part.content_type
        attachment
      end
    }.flatten.compact
  end      
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.