[template]
url = http://www.foo.com/
bpp = 4
maxdepth = 2
title = Foo
filename = foo
compression = zlib
####
use Date::Manip; # Date functions
use Mail::Internet; # parse incoming headers
use Config::Simple; # read thing=otherthing values
# For randomizing filenames
use Digest::MD5 qw(md5 md5_hex md5_base64);
my $date = UnixDate("today","%b %e, %Y at %T");
my $md5file = md5_hex($date);
my $workpath = "/tmp";
my $message = new Mail::Internet ([<>]);
my $from = $message->get('From');
my $subject = $message->get('Subject');
my @body = @{$message->body()};
# Config::Simple requires a file, so we create
# a temporary scratch file here, and write the
# contents of @body to it for storage
open(INFILE, ">$workpath/$md5file.msg") or die "$!";
print INFILE @body;
close ('INFILE');
my $cfg = newConfig::Simple(
filename => "$workpath/$md5file.msg");
my $template = $cfg->param(-block=>'template');
$url = $template->{url};
$bpp = $template->{bpp};
$maxdepth = $template->{maxdepth};
$compression = $template->{compression};
$filename = $template->{filename};
$title = $template->{title};
unlink "$workdir/$md5file.msg";
####
my $msg = MIME::Lite->new(
From =>'Email Reflector ',
To =>'me@domain.org',
Subject =>"Document built on $date",
Type =>'TEXT',
Data =>"Document requested on $date"
);
$msg->attach(Type =>'application/prs.plucker',
Path =>"$workpath/$md5file.pdb",
Filename =>"$title.pdb"
);
$msg->send;
####
[template]
url =
http://www.foo.com/some/long/path/longer/than/message/width
bpp = 4
maxdepth = 2
title = Foo
filename = foo
compression = zlib
####
[template]
url = http://www.foo.com/?url=www.bar.com&maxdepth=4
maxdepth = 2