10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
my $time = localtime;
my $mailprog = "/usr/lib/sendmail -oi -t";
open PIPE, "|$mailprog" or die $?;
print PIPE <<'EOM';
From: cron <foobar@example.org>
To: ich <foobar@example.org>
Subject: Test finished
at $time
EOM
close PIPE;
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
#!perl -w
use strict;
use warnings;
use File::Basename;
use MIME::Lite;
sub email {
my ($smtp_server, $to) = @_;
my $msg = MIME::Lite->new(
From => basename($0) . '@' . $ENV{COMPUTERNAME},
To => $to,
Subject => "Nur ein Test",
Type => 'multipart/mixed',
);
# email-Body dazu
$msg->attach(
Type => 'TEXT',
Data => "Habe fertig!\n",
);
# email-Anhänge dazu
$msg->attach(
Type => 'text/plain',
Path => $0,
Filename => basename($0),
);
eval { # email abschicken
$msg->send('smtp', $smtp_server);
};
if($@) {
print STDERR "Fehler beim Verschicken der email\n";
}
}
# email versenden
email("smtp-server.irgendwo.de", "fritz\@daheim.de");
10 Einträge, 1 Seite |