my $mapiSession = Win32::OLE->new("MAPI.Session"); die "Cannot create session\n" if not defined($mapiSession); #### Win32::OLE(0.1601) error 0x80010106: "Cannot change thread mode after it is set" at mail.pl line 16 eval {...} called at mail.pl line 16 Cannot create session #### my $xl = Win32::OLE->new("Excel.Application");