Thread [Tk] Emailvorlage öffnen (3 answers)
Opened by Kean at 2012-03-16 10:34

Kean
 2012-03-16 14:44
#156899 #156899
User since
2004-08-18
463 Artikel
BenutzerIn

user image
Da mailto leider sehr begrenzte Möglichkeiten hat (mir fehlt z.b. noch die Möglichkeit Formatierungen mitzugeben) habe ich das ganze jetzt doch über Outlook gelöst. Allerdings nicht über Mail::Outlook sondern direkt über Win32::OLE.

Hier die Umsetzung falls jemand eine ähnliche Aufgabe zu lösen hat:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';

my $outlook = new Win32::OLE('Outlook.Application') or die "Could not open Outlook Application!\n";

my $msg = $outlook -> CreateItem(0);
unless ($msg){ die "Outlook is not running, cannot send mail.\n"; }

$msg->{'To'}         = 'test@domain.de';
$msg->{'Subject'}     = 'Betreff';
$msg->{'BodyFormat'} = 'olFormatHTML';
$msg->{'HTMLBody'} = 'Dies ist ein <b>Test</b>';

my $attach = $msg->{'Attachments'};
$attach->add('c:\anhang.txt');

$msg->Display();

View full thread [Tk] Emailvorlage öffnen