Hey guys, i'm trying to add some extra functionality to a little program I wrote (perl first timer). I want to open a "new mail" outlook window with an attachment in it.
What follows is a little code snippet I found on the net. I edited this a bit but can't seem to add the attachment to the mail window.
The code opens the new mail window but there is no attachment in it.
It should contain a pdf doc located in the same folder as the script.
How can I add the attachment to the new mail windows?
The cpan documentation isn't really clear to me
http://search.cpan.org/~barbie/Mail-Outlook-0.15/lib/Mail/Outlook/Message.pm Thanks for the input
use Win32::OLE; use Win32::OLE qw(in with); use Win32::OLE::Variant; use Win32::OLE::Const 'Microsoft Outlook'; @attachments = ("output.pdf"); my $Outlook = Win32::OLE->GetActiveObject ('Outlook.Application') || Win32::OLE->new('Outlook.Application'); my $Outlook = new Win32::OLE('Outlook.Application'); # Create Mail Item my $item = $Outlook->CreateItem(0); # 0 = mail item. $attach = $item->{'Attachments'}; $attach->add(@attachments); $item->display();

In reply to WIN32:OLE insert attachment into mail object by muckv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.