Category: | Win32 stuff |
Author/Contact Info | Pierre Antonini pierre.antonini@kioskemploi.com |
Description: | The Outlook E-mail Security Update provides additional levels of protection against malicious e-mail messages. The update changes the way that Outlook can be controlled programmatically (Microsoft knowledgebase Q262701). Sending mail and accessing the Adress book display a dialog box asking you to confirm the action Dmitry Streblechenko at http://www.dimastr.com as released Redemption (http://www.dimastr.com/redemption/), an OLE object that works around limitations imposed by the Outlook Security Patch. Here is an example of using Redemption with Perl for sending e-mails : |
#!c:/perl/bin/perl use locale; use warnings; use Win32::OLE; use Win32::OLE::Const; use Win32::OLE::Const 'Microsoft Outlook'; $MailProps{'to'} = "sendto\@myserver.com"; $MailProps{'cc'} = "sendcc\@myserver.com"; $MailProps{'bcc'} = "sendbcc\@myserver.com"; $MailProps{'importance'} = 2; # 2=high, 1=normal, 0=low $MailProps{'subject'} = "Message subject"; $MailProps{'body'} = "Message body"; @Attachement = ("d:\\test.doc"); $MailProps{'attachments'} = \@Attachement; $Error = &OUT_SendMail (\%MailProps); print "Return error : ".$Error."\n"; exit; sub OUTLOOK_SendMail { my ($rMailProps) = @_; my $Application = new Win32::OLE('Outlook.Application'); my $MailItem = $Application->CreateItem(0); # 0 = mail item. unless (defined $MailItem) { print "Outlook is not running, cannot send mail.\n" if $Debug; return 1; } # Create a Redemption object my $SafeMailItem = new Win32::OLE('Redemption.SafeMailItem'); unless (defined $SafeMailItem) { print "Redemption is not running, cannot send mail.\n" if $Debug +; return 1; } # Set Item property of the Redemption object $SafeMailItem->{'Item'} = $MailItem; $SafeMailItem->{'To'} = join(";", split(/[ ,;]+/, $rMailProps->{'to +'})); $SafeMailItem->{'Cc'} = $rMailProps->{'cc'} if (exists $rMailProps- +>{'cc'}); $SafeMailItem->{'Bcc'} = $rMailProps->{'bcc'} if (exists $rMailProp +s->{'bcc'}); $SafeMailItem->{'Subject'} = $rMailProps->{'subject'} || '[No Subje +ct]'; $SafeMailItem->{'Body'} = $rMailProps->{'body'} || "\r\n"; $SafeMailItem->{'Importance'} = (exists $rMailProps->{'importance'} +)? $rMailProps->{'importance'} : 1; if (exists $rMailProps->{'attachments'}) { my $attach = $SafeMailItem->{'Attachments'}; foreach my $attach_file (@{ $rMailProps->{'attachments'} }) { if ($attach_file and -f $attach_file) { $attach->add($attach_file); } } } $SafeMailItem->Send(); return 0; } |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Win32::OLE Outlook and E-mail security update
by Foggy Bottoms (Monk) on Aug 06, 2003 at 14:17 UTC | |
Re: Win32::OLE Outlook and E-mail security update
by Foggy Bottoms (Monk) on Aug 08, 2003 at 14:44 UTC | |
by ThinMonk (Initiate) on Feb 11, 2005 at 13:12 UTC | |
Re: Win32::OLE Outlook and E-mail security update
by Anonymous Monk on Jun 03, 2004 at 17:08 UTC |
Back to
Code Catacombs