Leser: 1
![]() |
|< 1 2 3 >| | ![]() |
26 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
$file = param('file');
binmode $file;
$encoded_file = MIME::Base64::encode($file);
print MAIL <<EOA;
...
Content-Disposition: attachment; filename="$file"
$encoded_file
EOA
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
$boundary = '--=_'.substr(pack('u', ('E-Mail'.'Mieser Peter')), 0, 24);
open(MAIL, "| /usr/sbin/sendmail -n -t -oi") or die "Oh hoppla!";
print MAIL <<EOA;
From: $from
To: $to
Cc: $bc
Bcc: $bcc
Subject: $subject
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="$boundary"
--$boundary
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
$text
--$boundary
EOA
while ( read($file, $container, 1024) ) {
binmode($file);
local $/;
$encoded_file = MIME::Base64::encode($container);
}
print MAIL <<EOB;
Content-Type: image/jpeg; name="$file"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="$file"
$encoded_file
--$boundary
EOB
close(MAIL);
QuoteUnd da das Ganze auf UNIX läuft, spielt "binmode" eh keine Rolle.
1
2
3
4
5
6
7
BEGIN {
my $BCount = 0;
}
sub gen_boundary {
return ("_----------=_".int(time).$$.$BCount++);
}
![]() |
|< 1 2 3 >| | ![]() |
26 Einträge, 3 Seiten |