Fuism has asked for the wisdom of the Perl Monks concerning the following question:

I found a thread of how to send email using Outlook on here, but I cant seem to figure out how to send it with attachments. I also looked on the web and couldnt find anything of how to do this. Any help would be greatly appreciated. Here is the code:
use Win32::OLE; $mail = new Win32::OLE('Outlook.Application'); $mail->{'Visible'} = 1; $item = $mail->CreateItem(0); $item->{'Subject'} = "This is a test"; $item->{'To'} = "name\@comp.com"; $item->{'Body'} = "Here is the meat of the message"; $item->{'Attachments'} = $attachments; ## I'd assume this would work b +ut it doesnt... $item->Send(); #$mail->Quit();
Thanks in advance, Fuism

Replies are listed 'Best First'.
Re: Win32:OLE using Outlook
by rjbs (Pilgrim) on Sep 21, 2004 at 18:45 UTC
    KB161088 includes code to send attachments. If it's to be trusted then you want something like:

    $item->Attachments->Add($path_to_attachment);
    rjbs
      Awesome, thank you kind sir... Its great to have so many intelligent people walking around :) -Fuism