tmail/sample/multipart.rb

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

require 'tmail/tmail'

mail = TMail::Mail.loadfrom( 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 mail.body
  puts
end

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

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