8 |
|
|
9 |
use MIME::Parser; |
use MIME::Parser; |
10 |
|
|
11 |
my $outdir = "/tmp/store"; |
my $outdir = "/data/store"; |
12 |
my $msgdir = "/tmp/mime$$"; # temp |
my $msgdir = "/data/store/tmp/mime$$"; # temp |
13 |
my $to = "dpavlin@pliva.hr"; |
my $from = 'clipping-info@pliva.hr'; |
14 |
|
my $to = 'clipdir@pliva.hr'; |
15 |
|
|
16 |
print "From: Press Clipping <pcst\@pliva.hr>\nSubject: Press Clipping update\n\n"; |
open(MAIL,"| /usr/sbin/sendmail $to") || die "sendmail: $!"; |
17 |
|
|
18 |
|
print MAIL "From: Press Clipping <$from>\nSubject: Press Clipping update\n\n"; |
19 |
|
|
20 |
#------------------------------------------------------------ |
#------------------------------------------------------------ |
21 |
# dump_entity - dump an entity's file info |
# dump_entity - dump an entity's file info |
31 |
# " (", scalar($ent->head->mime_type), ")\n"; |
# " (", scalar($ent->head->mime_type), ")\n"; |
32 |
if ($ent->head->mime_type =~ m,text/plain,i) { |
if ($ent->head->mime_type =~ m,text/plain,i) { |
33 |
open(I,$ent->bodyhandle->path) || die "$ent->bodyhandle->path: $!"; |
open(I,$ent->bodyhandle->path) || die "$ent->bodyhandle->path: $!"; |
34 |
while(<I>) { print $_; } |
while(<I>) { print MAIL $_; } |
35 |
close(I); |
close(I); |
36 |
unlink $ent->bodyhandle->path; |
unlink $ent->bodyhandle->path; |
37 |
} else { |
} else { |
43 |
my $md5=md5_hex($new.time()); |
my $md5=md5_hex($new.time()); |
44 |
mkdir "$outdir/$md5",0755 || die "mkdir $outdir/$md5: $!"; |
mkdir "$outdir/$md5",0755 || die "mkdir $outdir/$md5: $!"; |
45 |
rename $file,"$outdir/$md5/$new" || die "$file -> $md5 $new: $!"; |
rename $file,"$outdir/$md5/$new" || die "$file -> $md5 $new: $!"; |
46 |
print "\nhttp://store.pliva.hr/$md5/$new\n"; |
print MAIL "\n","-" x 76,"\nhttp://store.pliva.hr/$md5/$new\n"; |
47 |
} |
} |
48 |
} |
} |
49 |
} |
} |
79 |
#------------------------------------------------------------ |
#------------------------------------------------------------ |
80 |
1; |
1; |
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|