QuoteC:\Install\Neustart_Info>cd "C:\Install\Neustart_Info\"
C:\Install\Neustart_Info>perl Neustart_Info.pl --to="jan.xxxxx@xxxxx.de"
OK. Log says:
Mail::Sendmail v. 0.79 - Wed Jun 29 09:42:19 2016
Date: Wed, 29 Jun 2016 09:42:19 +0200
Server: xxxxx.local.xxxxx.de Port: 25
From: gis-hotline@ebhl.de
Subject: ** NEUSTART Server: xxxxx.local.xxxxx.de
To: jan.xxxxx@xxxxx.de
Result: 250 2.6.0 <a8392f45-fe29-4e1d-817e-2b8903d27371@xxxxx.local.xxxx.d
e> [InternalId=14255] Queued mail for delivery
C:\Install\Neustart_Info>pause
Drücken Sie eine beliebige Taste . . .
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
65
66
67
#!/usr/bin/perl
# Historie
use strict;
use warnings;
use Getopt::Long;
use Win32::Service;
use Mail::Sendmail;
use 5.010;
use POSIX;
# main-parameters
my %config=(
"email_to"=>'', # es kann auch eine Liste von Empfaengern angegeben werden, Trennzeichen ";"
"email_from"=>'xxxxxx-xxxxxx@xxxxxx.de', # von wem wird die eMail versandt
"email_pwd"=>'xxxxxx', # Anmeldepasswort am Exchange
"email_required"=>1, # eine Authorisierung erforderliche?
"email_smtp"=>'xxxxxx.local.xxxxxx.de', # Exchange-Server
# werden erst später belegt
"email_subject"=>'',
"email_subject_error"=>'',
);
GetOptions
(
"help|h" => sub{ Usage(); },
"to=s" => \$config{email_to},
) or Usage();
sub Usage
{
my( $message ) = @_;
if( $message )
{
print "$message\n" if ($config{silent} == 1);
}
print "\t-help\tDokumentation dieses Skriptes\n";
print "\n";
print "\t-to\t\tEmpfaenger fuer eMail - nur eine derzeit moeglich\n";
print "....\n";
exit 0; # beenden
}
my $hostname = 'localhost'; # this means local host.
my $name_of_this_machine = (gethostbyname ($hostname))[0];
my %mail = ( To => $config{email_to},
From => $config{email_from},
Message => "Diese Mail wurde automatisch verschickt!",
Subject => "** NEUSTART Server: ".$name_of_this_machine,
);
$mail{auth} = {user=>$config{email_from}, password=>$config{email_pwd}, required=>$config{email_required} };
$mail{Smtp} = $config{email_smtp};
sendmail(%mail) or die $Mail::Sendmail::error;
print "OK. Log says:\n", $Mail::Sendmail::log ;
exit (0);