I'm trying to send email from a perl script to MS Outlook.
Here's my code:
use lib qw(lib);
use Mail::Outlook;
my $mail = new Mail::Outlook();
die "Cannot create mail object\n" unless $mail;
my $message = $mail->create();
die "Cannot create message object\n" unless $message;
$message->To('test@test.net');
#$message->Cc('Test <test@example.com>');
$message->XHeader('X-Header2','That');
$message->Subject('Blah Blah Blah');
$message->Body('Yadda Yadda Yadda');
my $status = $message->display;
print STDERR "message status was [$status]\n";
$message->send;
This works fine if I run it as a standalone perl script. If I embed it in another perl script it gives me the error message, 'Cannot Create Mail Object'. Any ideas why?
Here's my code:
use lib qw(lib);
use Mail::Outlook;
my $mail = new Mail::Outlook();
die "Cannot create mail object\n" unless $mail;
my $message = $mail->create();
die "Cannot create message object\n" unless $message;
$message->To('test@test.net');
#$message->Cc('Test <test@example.com>');
$message->XHeader('X-Header2','That');
$message->Subject('Blah Blah Blah');
$message->Body('Yadda Yadda Yadda');
my $status = $message->display;
print STDERR "message status was [$status]\n";
$message->send;
This works fine if I run it as a standalone perl script. If I embed it in another perl script it gives me the error message, 'Cannot Create Mail Object'. Any ideas why?