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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -