Thread Probleme mit dem Mailversand nach Umstieg auf Perl 5.10 (26 answers)
Opened by Michael at 2010-12-16 12:07

Gast Michael
 2010-12-20 14:36
#143737 #143737
Juhuu, hat geklappt. Vielen, vielen Dank an alle :-)

Das neue Script sieht so aus:

Code (perl): (dl )
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
60
61
62
63
64
#!/usr/bin/perl

### Variablen erzeugen
my $to = "$ARGV[0]\@domain";
my $from = "$ARGV[1]";
my $replay = "email";
my $subject = "$ARGV[2] $ARGV[3] $ARGV[4]";
my $workdir = "$ARGV[7]";
my $tempdir = "$ARGV[7]/tmp";
my $cwffile = "$ARGV[6]";
my $htmlfile = "$ARGV[5]";

### Modul einbinden
use MIME::Lite;

### "Container" für die Multipartmessage erstellen
$msg = MIME::Lite->new(
    From     =>"$from",
    To       =>"$to",
    ReplyTo =>"$replay",
    Subject  =>"$subject",
    Type     =>'multipart/related',
    );

### HTML-Datei öffnen, lesen, Inhalt in die Email schreiben und schließen
open(FILE, "$tempdir/$htmlfile") or die "Can't open data: '$htmlfile'!\n$!";
read(FILE, $buf, 60*57);

$msg->attach(
        Type     =>'text/html',
        Data     =>"$buf"
    );

close(FILE);

### Erstes Bild einbetten
$msg->attach(
    Type        =>'image/gif',
    Encoding    =>'base64',
    Filename    =>'image001.gif',
    Disposition =>'inline',
    Path        =>"$workdir/image001.gif"
    );

### Zweites Bild einbetten
$msg->attach(
    Type        =>'image/gif',
    Encoding    =>'base64',
    Filename    =>'image002.gif',
    Disposition =>'inline',
    Path        =>"$workdir/image002.gif"
    );

### Linkfile anhängen
$msg->attach(
    Type        =>'text/plain',
    Encoding    =>'7bit',
    Filename    =>"$cwffile",
    Disposition =>'attachment',
    Path        =>"$tempdir/$cwffile"
    );

### Nachricht versenden
$msg->send();


Wenn noch was verbessert werden kann ... ich lerne gerne :-)

VG, Michael

View full thread Probleme mit dem Mailversand nach Umstieg auf Perl 5.10