#!/usr/bin/perl -w

use lib ',..';
use Mail::Message;

my $infile = '/etc/group';
my @prelude = ("  This message is in MIME format.  The following part\n",
               "  is BASE64 encoded and contains encrypted data.\n");


my $filename = 'filename_clientside.txt';
my $to = 'wiggins@danconia.org';
my $subject = 'Sample subject line';
my %xheaders = ('Status' => '1','OrigName' => 'original file name');

my $head = new Mail::Message::Head;
$head->add('To'=>$to);
$head->add('Subject'=>$subject);
$head->add("X-$_" => $xheaders{$_}) foreach (sort(keys(%xheaders)));

my $text = new Mail::Message::Body::Lines ( 'disposition' => 'inline',
                                            'data' => \@prelude,
                                          );

my $attachment = new Mail::Message::Body::File ( 'file' => $infile,
                                                 'disposition' => "attachment;
+filename=\"$filename\"",
                                               );

my $msg = Mail::Message->build('head' => $head,
                               'attach' => $text,
                               'attach' => $attachment,
                              );

$msg->print;
