#!/usr/local/bin/ruby
#
# MIME multipart body
#

require 'tmail'

mail = TMail::Mail.load_from( ARGV[0] || 'm/multipart' )

puts '-------------- multipart mail parsing test -----------------'
puts

puts '========= preamble =============='
print mail.body
puts

puts '========== parts ================'
mail.parts.each_with_index do |i,idx|
  puts "<#{idx+1}>"
  print i
  puts
end

puts '========= epilogue =============='
print mail.epilogue
puts

puts "========= re-struct ============="
print mail.decoded
puts
