#!/usr/bin/perl -w
# test simple perl sender Author Manfred Shoenfeld
# ---- Initialisierung  defaults ------------------------------------------------
#my $receiver="prod\@fqdn.net";
#my $receiver="manfred.schoenfeld\@fqdn.net";
my $receiver="manfred.schoenfeld\@fqdn.com";

my $sender="root\@xxhostyy.worldline.com";
my $subject="test mail";
my $text="test mail aus script";


# ---  create  parameters
#my $domain="atos.net";
my $domain="fqdn.com";
#my $domain="equensworldline.com";
#my $domain="ffm.de.int.atosorigin.com";
#my $domain="sys.meshcore.net";

my $hostname=qx(hostname);
chomp($hostname);

my $name = qx(whoami);
chomp($name);

#my $senddate = qx(date);
my $senddate = qx(date +\"%d.%m.%y  %H:%M\");
chomp($senddate);


$sender = "$name"."\@"."$hostname"."."."$domain";
$subject = "test mail send at  $senddate";

print "hostname: $hostname\n";
print "name: $name\n";
print "senddate: $senddate\n";
print "sender: $sender\n";
print "subject: $subject\n";


system( "echo \"$text\" | mailx -r \"$sender\" -s \"$subject\"  \"$receiver\"" );
#system( "echo \"$text\" | mailx -s \"$subject\"  \"$receiver\"" );

exit;

