http://www.perlmonks.org?node_id=128957

Thanks to the code written in various Q&A sections, i wrote my own function to send mail using Outlook. This function uses Win32::OLE (of course), and returns 0 on failure and 1 for success. It does *not* open or close Outlook, which was outside the scope of the function - you can open or close it yourself in the calling code. I'll follow up with a similar function that uses the CDONTS lib instead of Outlook.
sub outlook_mailer { my(%mail_props) = @_; unless (exists $mail_props{'to'} and defined $mail_props{'to'}) { carp "No Addressee to send mail to.\n"; return 0; } my $mail = new Win32::OLE('Outlook.Application'); my $item = $mail->CreateItem(0); # 0 = mail item. unless ($item) { carp "Outlook is not running, cannot send mail.\n"; return 0; } $item->{'Subject'} = $mail_props{'subject'} || '[No Subject]'; $item->{'To'} = join(";", split(/[ ,;]+/, $mail_props{'to'})); $item->{'Body'} = $mail_props{'body'} || "\r\n"; $item->{'From'} = $mail_props{'from'} if (exists $mail_props{'from'} +); $item->{'Cc'} = $mail_props{'cc'} if (exists $mail_props{'cc'}); $item->{'Bcc'} = $mail_props{'bcc'} if (exists $mail_props{'bcc'}); $item->{'Importance'} = (exists $mail_props{'importance'})? $mail_props{'importance'}: 1; # 2=high, 1=normal, 0=low if (exists $mail_props{'attachments'}) { my $attach = $item->{'Attachments'}; foreach my $attach_file (@{ $mail_props{'attachments'} }) { if ($attach_file and -f $attach_file) { $attach->add($attach_file); } } } $item->Send(); return 1; }