#!/usr/bin/perl
use warnings;
use strict;
use lib '../lib';
use Mail::Message;
 my %headers;
 $headers{'From'} = 'from';
 $headers{'To'} = 'to';
 $headers{'Subject'} = 'subj';
 my $head = Mail::Message::Head->build(%headers);

 my $body = Mail::Message::Body::Lines->new
         ( data => "hoi\n"
         );

 my $disp = Mail::Message::Field->new
         ('Content-Disposition'  => 'attachment'
         , filename              => 'my first file'
         );

 my $att = Mail::Message::Body::Lines->new
         ( file                  => '/etc/passwd'
         #, mime_type            => 'text/plain'
         , mime_type             => 'application/octet-stream'
         , disposition           => 'attachment'
         );

 $att = $att->encode
         ( transfer_encoding     => 'base64'
         );

 my $multipartBody = $body->attach($att);
 $multipartBody->boundary('ThisIsABoundaryLine');
 my $msg = Mail::Message->buildFromBody
         ( $multipartBody
         , $head
         );

 $msg->head->delete('Content-Length');
 $msg->head->delete('Lines');
 $msg->body->part(0)->head->delete('Lines');
$msg->print;
