1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
use Excel::Writer::XLSX;
use MIME::Lite;
my $q = new CGI;
print $q->header();
print $q->start_html();
print $q->h1('test');
print $q->end_html();
my $workbook = Excel::Writer::XLSX->new( 'test.xlsx' );
my $worksheet = $workbook->add_worksheet();
$worksheet->write( 0, 0, 'Test' );
$workbook->close();
my $email = MIME::Lite->new (
From => 'xxx',
To => 'yyy',
Subject => 'test',
Encoding => 'quoted-printable',
Data => 'test',
Type => 'text/html'
);
$email->attach (
Encoding => 'base64',
Type => 'application/vnd.ms-excel',
Path => $ENV{'DOCUMENT_ROOT'}.'/cgi-bin/test/excel/test.xlsx',
Filename => 'test.xlsx'
);
$email->send('smtp', "zzz", Timeout=>60);
1 2 3
open my $fh, '>', \my $str or die "Failed to open filehandle: $!"; my $workbook = Excel::Writer::XLSX->new( $fh );
2013-09-30T11:51:21 MartinRWie bekomme ich nun dieses "$fh" bzw. "$str" in mein Mail als Anhang rein?