Thread email-Versand mit Perl (n.f. Windows und Outlook): Speziell fuer snadra :-) (14 answers)
Opened by havi at 2003-09-03 14:59

havi
 2003-09-03 14:59
#83232 #83232
User since
2003-08-04
2036 Artikel
BenutzerIn
[Homepage]
user image
Code: (dl )
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
#!/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;


mfg havi

View full thread email-Versand mit Perl (n.f. Windows und Outlook): Speziell fuer snadra :-)