Hi Monks, is there a good way to add a result set that's stored in an array into the body of message in Outlook. I'm pulling data from a report each night and sending an email in the morning.
#!/usr/bin/perl -w use strict; use warnings; use POSIX; use Win32::OLE; open SOURCE, "< //reports/test.txt"; my $procdate = POSIX::strftime('%m/%d/%Y %H:%M', localtime); my @ies_details; my $Outlook = Win32::OLE->GetActiveObject('Outlook.Application') || Wi +n32::OLE->new('Outlook.Application'); #$Outlook = new Win32::OLE('Outlook.Application'); while(<SOURCE>) { my $source = $_; next if ($source =~ m/^(\s)*$/); next unless (substr($source,11,4) =~ m/(\d){4}/); if (substr($source,79,10) =~ /(\d){10}/) { push @ies_details,$source; } } my $test; foreach (@ies_details) { $test = $test . $_; }; my $mailitem = $Outlook->CreateItem(0); #Create mail Item unless ($mailitem) {die "Outlook is not running, cannot send mail. +\n";} $mailitem->{'To'} = 'test@yahoo.com'; $mailitem->{'Cc'} = 'test@test.com'; $mailitem->{'Subject'} = 'Summary Report ' . $procdate; $mailitem->{'Body'} = 'Below is a summary.' . "\n\n" . '-----------------------------------------' . "\n\n" . $test; $mailitem->{'Importance'} = 0; # 2=high, 1=normal, 0=low $mailitem->Send;
In reply to Add Results to Outlook body by drodinthe559
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |