#!/usr/bin/perl
use warnings;
use strict;
use Win32::OLE;
my $To = ""; $To = shift;
my $Cc = ""; $Cc = shift;
my $Subject = ""; $Subject = shift;
my $Body = ""; $Body = shift;
($To) or die "USAGE: $0\n <\"To\">\n [<\"Cc\">]\n [<\"Subject\">]\n [<\"Body\">]\n [<\"Attachment 1\">]\n [<\"Attachment 2\">]\n [<\"Attachment ...\">]\n";
my $Email = Win32::OLE->new('Outlook.Application') or die $!;
my $Items = $Email->CreateItem(0) or die $!;
$Items->{'To'} = $To;
$Items->{'CC'} = $Cc;
$Items->{'Subject'} = $Subject;
$Items->{'Body'} = $Body;
foreach my $Attach (@ARGV) {
die $! if not -e $Attach;
my $Attachments = $Items->Attachments();
$Attachments->Add($Attach);
} # foreach
$Items->Send();
my $Error = Win32::OLE->LastError();
print "Email wurde erfolgreich gesendet.\n" if not $Error;
print "Email konnte nicht versendet werden.\n" if $Error;
1;