instance method
attachment
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v2.3.18 PrivateSignature
attachment(part)
No documentation comment.
Parameters
-
partreq
Source
# File actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb, line 45
def attachment(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') ||
'noname'
return if content.blank?
attachment = TMail::Attachment.new(content)
attachment.original_filename = file_name.strip unless file_name.blank?
attachment.content_type = part.content_type
attachment
end
end
Defined in actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb line 45
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in TMail::Mail