Outlook does not run script in HTML messages. It's a security issue. The
only way you can get it to run is to tell the user to invoke the View | View
in Internet Zone (which I'd block if I were a security admin) command.
If it's for internal use, then an Outlook form might be appropriate and can
include script to invoke your COM object.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
Gary said:
Sue,
I know it's off-subject, but I've posted a question on here and in your
website forum but wonder if you could take a quick look at my problem for me
please....?
Here's the post:
I have a simple enough request I think but cannot find a solution. I have
a VB app that creates email messages and emails staff inside our
corporation. The email message needs to run some client-side code to access
a local COM object.
The problem is that whenever I add anything resembling client-side code
into the HTMLBody it gets stripped out either when created or when received
by the recipient (I'm not sure). We use Windows 2000 Pro, Outlook 2002 and
Exchange 2000.
An example: when I add <Script language=...> in the <Head> tag, the whole
I can't even add a <A OnClick=...> tag. The moment I add the word
"OnClick" this link won't work.
The only way I can get something to work is to call a hyperlink to an ASP
page and pass the necessary parameters through to a webpage. On the webpage
the ASP creates the required client-side script and finally I can access the
COM object but this seems like overkill.
And the biggest problem using this method is that I cannot control the
automatic closing of the webpage that pops up in Internet Explorer. I can
add a window.close command after the COM object has run but it ALWAYS
displays a messagebox alerting the user that something is attempting to
close the window and should they allow this. Most frustrating! Ideally I
don't want a webpage to startup everytime the use clicks something on the
email message - I just want the COM object to run with some passed
parameters - this is the primary goal.
Can anyone suggest a simple piece of code that Outlook WILL allow to exist
in the email body that can run my COM object somehow? If we can reduce some
security in Outlook to allow this then that's FINE, as we are securely
behind several firewall systems. I have wondered if I could hide the COM
code in a server-based custom form? I haven't used forms much yet but it
that's the only way, I'll learn.