diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2009-11-12 16:08:50 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2009-11-12 16:08:50 +1100 |
commit | 15d7cac282e29f0a8e7b38dade07abb32d97a991 (patch) | |
tree | 573d27da4f642b2b16840fbc7621d85acd8634ea /actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb | |
parent | cbded53671bccccbaf7e9fdfa93ef86cb097daa3 (diff) | |
download | rails-15d7cac282e29f0a8e7b38dade07abb32d97a991.tar.gz rails-15d7cac282e29f0a8e7b38dade07abb32d97a991.tar.bz2 rails-15d7cac282e29f0a8e7b38dade07abb32d97a991.zip |
Starting again on actionmailer integration with mail
Diffstat (limited to 'actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb deleted file mode 100644 index 5dc5efae5e..0000000000 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb +++ /dev/null @@ -1,46 +0,0 @@ -=begin rdoc - -= Attachment handling file - -=end - -require 'stringio' - -module TMail - class Attachment < StringIO - attr_accessor :original_filename, :content_type - end - - class Mail - def has_attachments? - multipart? && parts.any? { |part| attachment?(part) } - end - - def attachment?(part) - part.disposition_is_attachment? || part.content_type_is_text? - end - - 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 - end -end |