2014-09-03 68 views
0

我將腳本放在一起發送測試電子郵件,我需要更改字段,但是這不會改變我放在腳本上的內容嗎?我也該如何請求所有收件人的收貨收據。非常感謝perl從字段的外觀不改變到寫什麼?

#!/usr/bin/perl 
use strict; 
use warnings; 

use Win32::OLE::Const 'Microsoft Outlook'; 
use Mail::Outlook; 
my $Outlook; 
eval { $Outlook = Win32::OLE->GetActiveObject('Outlook.Application') }; 
die "Outlook not installed" if [email protected]; 
unless (defined $Outlook) { 
    $Outlook = Win32::OLE->new('Outlook.Application', sub { $_[0]->Quit; }) 
     or die "Oops, cannot start Outlook"; 
} 
my $outlook = new Mail::Outlook(); 
# create a message for sending 
my $message = $outlook->create(); 
$message->From('#######.com'); 
$message->To('#####.com; ppppp.co.uk'); 
$message->Cc('o#####.com'); 
$message->Bcc(''); 
$message->Subject('Test'); 
$message->Body('Test Regards'); 

$message->display; 
exit; 

回答

0

@ user3360439:而不是將這些值在從(「##### COM」)直接使用的哈希變量和發送。

# Or use a hash 
    my %hash = (
    From => '[email protected]', 
    To  => '[email protected]', 
    Subject => 'greetings', 
    Body => 'Hello', 
); 

    my $message = $outlook->create(%hash); 
    $message->display(%hash); 
    $message->send(%hash);