Leser: 1
7 Einträge, 1 Seite |
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/perl
use strict;
use Time::Local;
use MIME::Base64;
# Variablen-Blub
#my(subject, text, htmlxode, ...) =
my $bild_anhang_dateiname = $dir_pic.'grafik.gif';
my $bild_anhang;
open(BILD, "<$bild_anhang_dateiname");
#binmode(BILD);
my $bild_anhang_dateigroesse = -s $bild_anhang_dateiname;
read(BILD, $bild_anhang, $bild_anhang_dateigroesse);
close(BILD);
my $mail_grafik = encode_base64($bild_anhang);
my $boundary = 'Message-Boundary'.'___'.time.$user_id.time;
my $boundary2 = 'Message-Boundary_2'.'___'.$user_id.time.$user_id;
open (MAIL, "|$mailprog -oi -t");
print MAIL "MIME-Version: 1.0\n";
#print MAIL "Return-Path: $mailsender\n";
print MAIL "Content-Type: multipart/alternative; boundary=\"$boundary\"\n";
print MAIL "From: $mailsender\n";
print MAIL "To: $user_email\n";
print MAIL "Subject: $subject\n\n";
print MAIL "This is a multi-part message in MIME format.\n";
print MAIL "--".$boundary."\n";
#### Die Nachricht als Text-Mail
print MAIL "Content-Type: text/plain; charset=\"utf-8\"\n";
print MAIL "Content-Transfer-Encoding: 8bit\n";
print MAIL "$text_part01 $user_name,\n\n";
print MAIL "$text_part02\n\n";
print MAIL "$text_part03\n";
print MAIL "$mail_link01\n\n";
print MAIL "$text_part04\n\n";
print MAIL "--".$boundary."\n";
### Anfang des 2. Teil der Mail mit HTML und Grafik (multipart/mixed)
print MAIL "Content-Type: multipart/mixed; boundary=\"$boundary2\"\n\n";
print MAIL "--".$boundary2."\n";
## Die Nachricht als HTML-Mail
print MAIL "Content-Type: text/html; charset=\"utf-8\"\n";
print MAIL "Content-Transfer-Encoding: quoted-printable\n";
print MAIL "$html_mail_message\n";
print MAIL "--".$boundary2."\n";
#print MAIL "Content-type: application/octet-stream; name=\"grafik.gif\"\n";
print MAIL "Content-type: image/gif; name=\"grafik.gif\"\n";
print MAIL "Content-transfer-encoding: base64\n";
#print MAIL "Content-Disposition: attachment; filename=\"grafik.gif\"\n";
print MAIL "Content-Disposition: inline; filename=\"grafik.gif\"\n";
print MAIL "$mail_grafik\n";
print MAIL "\n";
### Ende des 2. Teil der Mail mit HTML und Grafik (multipart/mixed)
print MAIL "--".$boundary2."--\n\n";
print MAIL "--".$boundary."--\n";
close (MAIL);
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
37
38
39
40
41
my $msg = MIME::Lite->new(
From => "$mailsender",
To => "$user_email",
Subject => "$subject",
Type => 'multipart/mixed',
);
$msg->attach( Type => 'text/plain; charset="utf-8"',
Encoding => 'quoted-printable',
Data => "$text_mail_message");
$msg->attach( Type => 'text/html; charset="utf-8"',
Encoding => 'quoted-printable',
Data => "$html_mail_message");
$msg->attach( Type => 'image/gif',
Encoding => 'base64',
Path => "$dir_pic"
);
MIME::Lite->send('sendmail', "/usr/sbin/sendmail -t -oi");
$msg->send;
7 Einträge, 1 Seite |