ole - Generate Mail and Open it in Outlook using Perl -


does know how can make mail in perl using outlook , not send open on screen @ end of making mail , let user verify , send mail. using win32::ole making mail.

pfb code using:

sub final_mail_outlook{      my($mailto,$mailfrom,$subject,$body) = (@_);      $outlook = win32::ole->getactiveobject('outlook.application') || win32::ole->new('outlook.application');      # create mail item     $item = $outlook->createitem(0);  # 0 = mail item.      unless ($item)     {         die "outlook not running, cannot send mail.\n";     }      $item->{'subject'} = $subject;     $item->{'to'} = $mailto;     $item->{'body'} = $body;     $item->{'from'} = $mailfrom;     $attach = $item->{'attachments'};     @outputfiles = glob("$outputpath\\*.*");     foreach $file (@outputfiles){         $attach->add($file);     }     $item->send(); } 

this sends mail have called send function, want verify mail generated. there way so???

i found answer thought of posting else needing answer can help. key use function display() instead of send(). pfb modified code open mail , not send it.

sub final_mail_outlook{      my($mailto,$mailfrom,$subject,$body) = (@_);      $outlook = win32::ole->getactiveobject('outlook.application') || win32::ole->new('outlook.application');      # create mail item     $item = $outlook->createitem(0);  # 0 = mail item.      unless ($item)     {         die "outlook not running, cannot send mail.\n";     }      $item->{'subject'} = $subject;     $item->{'to'} = $mailto;     $item->{'body'} = $body;     $item->{'from'} = $mailfrom;     $attach = $item->{'attachments'};     @outputfiles = glob("$outputpath\\*.*");     foreach $file (@outputfiles){         $attach->add($file);     }     $item->display(); } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -