Perl 能否将图像粘贴到outlook电子邮件正文中?
我有一个脚本,它获取TKGUI的屏幕截图并将其存储在windows剪贴板中。 然后我想将图像粘贴到outlook电子邮件正文中,这是否可行? 这就是我到目前为止所做的:Perl 能否将图像粘贴到outlook电子邮件正文中?,perl,Perl,我有一个脚本,它获取TKGUI的屏幕截图并将其存储在windows剪贴板中。 然后我想将图像粘贴到outlook电子邮件正文中,这是否可行? 这就是我到目前为止所做的: #!/usr/bin/perl use strict; use warnings; use Win32::OLE::Const 'Microsoft Outlook'; use Mail::Outlook; use Win32::Clipboard; use Win32::GuiTest qw(FindWindowLike Se
#!/usr/bin/perl
use strict;
use warnings;
use Win32::OLE::Const 'Microsoft Outlook';
use Mail::Outlook;
use Win32::Clipboard;
use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys);
my @windows = FindWindowLike(0, qr/^test gui/);
for (@windows) {
SetForegroundWindow($_);
SendKeys('%{PRTSCR}');
}
my $screen = Win32::Clipboard::GetBitmap() or warn "No image captured: $!\n";
# Print the image to a file.
open BITMAP, "> C:\\temp\\screen1.jpeg"
or warn "Couldn't open bitmap file: $!\n";
binmode BITMAP;
print BITMAP $screen;
close BITMAP;
# create Outlook message
my $Outlook;
eval {$Outlook = Win32::OLE->GetActiveObject('Outlook.Application')};
die "Outlook not installed" if $@;
unless (defined $Outlook) {
$Outlook = Win32::OLE->new('Outlook.Application', sub {$_[0]->Quit;})
or die "Oops, cannot start Outlook";
}
my $outlook = new Mail::Outlook();
my $message = $outlook->create();
$message->To('joebloggs.com');
$message->Subject('test image');
$message->Body( '^V' );
$message->display;
看看你有没有试过一个带有数据URL的图像标签?