--- mail2sap.pl 2002/11/19 18:20:55 1.7 +++ mail2sap.pl 2003/02/04 13:03:07 1.8 @@ -22,6 +22,8 @@ # temporary directory (ON SAME FILESYSTEM AS $outdir -- we use rename!) # for extraction of *ALL* attachements my $msgdir = $config->{msgdir} || die "config: no defined"; +my $mntdir = $msgdir; +$msgdir .="/mime"; $msgdir .= "$$"; # append PID to make it unique my $log = $config->{log} || die "config: no defined"; @@ -62,7 +64,9 @@ $new .= $suffix; rename $file,"$outdir/$new" || die "move $file -> $outdir/$new: $!"; - print LOG scalar localtime," $new\n"; + my $prog = $0; + $prog =~ s/^.*\/([^\/])+$/$1/g; + print LOG scalar localtime," $prog $new\n"; # now, call SAP rfc @@ -104,8 +108,9 @@ sub main { my $file; my $entity; - - mkdir $msgdir,0755 || die "can't create $msgdir: $!"; + + chdir ($mntdir) || die "can't chdir to $mntdir: $!"; + mkdir ($msgdir,0755) || die `id`."can't create $msgdir: $!"; die "problems with creation of directory $msgdir: $!" if (! -w $msgdir); my $parser = new MIME::Parser;