ccc
28-02-2004, 00:11
hallo
ich probiere folgendes script gemäss:
http://www.perl.com/pub/a/2003/09/03/perlcookbook.html?page=2
zum laufen zu bringen.
bekomme weder mail noch attachment, aber keine fehlermeldungen
weiss jemand vielleich was da falsch ist ?
#!/usr/bin/perl -w
use MIME::Lite;
use Getopt::Std;
my $SMTP_SERVER = '/usr/sbin/sendmail -t';
my $DEFAULT_SENDER = 'root@mydomain.net';
my $DEFAULT_RECIPIENT = 'xxx@mydomain.net';
MIME::Lite->send('smtp', $SMTP_SERVER, Timeout=>60);
my (%o, $msg);
# process options
getopts('hf:t:s:', \%o);
$o{f} ||= $DEFAULT_SENDER;
$o{t} ||= $DEFAULT_RECIPIENT;
$o{s} ||= 'attachment';
if ($o{h} or !@ARGV) {
die "usage:\n\t$0 -h -f -t -s /var/log.txt\n";
}
# construct and send email
$msg = new MIME::Lite(
From => $o{f},
To => $o{t},
Subject => $o{s},
Data => "Hi",
Type => "multipart/mixed",
);
while (@ARGV) {
$msg->attach('Type' => 'application/octet-stream',
'Encoding' => 'base64',
'Path' => shift @ARGV);
}
$msg->send( );
gruss
ccc
ich probiere folgendes script gemäss:
http://www.perl.com/pub/a/2003/09/03/perlcookbook.html?page=2
zum laufen zu bringen.
bekomme weder mail noch attachment, aber keine fehlermeldungen
weiss jemand vielleich was da falsch ist ?
#!/usr/bin/perl -w
use MIME::Lite;
use Getopt::Std;
my $SMTP_SERVER = '/usr/sbin/sendmail -t';
my $DEFAULT_SENDER = 'root@mydomain.net';
my $DEFAULT_RECIPIENT = 'xxx@mydomain.net';
MIME::Lite->send('smtp', $SMTP_SERVER, Timeout=>60);
my (%o, $msg);
# process options
getopts('hf:t:s:', \%o);
$o{f} ||= $DEFAULT_SENDER;
$o{t} ||= $DEFAULT_RECIPIENT;
$o{s} ||= 'attachment';
if ($o{h} or !@ARGV) {
die "usage:\n\t$0 -h -f -t -s /var/log.txt\n";
}
# construct and send email
$msg = new MIME::Lite(
From => $o{f},
To => $o{t},
Subject => $o{s},
Data => "Hi",
Type => "multipart/mixed",
);
while (@ARGV) {
$msg->attach('Type' => 'application/octet-stream',
'Encoding' => 'base64',
'Path' => shift @ARGV);
}
$msg->send( );
gruss
ccc