How to access COM objects from inside email?

G

Gary Forsyth

I have a simple enough request I think but cannot find a solution. I have a VB6 app that extracts data from SQL and creates Outlook email messages that are sent to staff inside our corporation. The receiver needs to be able to click on various items in the email body and these should somehow pass parameters to a local COM object that is installed on every computer. I have been using HTMLBody content and constructing HTML code with the items listed.

The problem is that whenever I add anything resembling client-side scripting code (to access the local COM object) 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 <Script> section disappears but other tags like <Style> remain intact
I can't even add a <A OnClick=...> tag. <A> tags with "OnClick" events don't work either

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 local 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? I've even considered using IFRAMES in the HTMLBody as these can contain other HTML pages, but again I can't figure out how to pass information to the IFRAME from a simple <A> tag (I've tried naming the IFrame and setting the <A> tag target to the iframe name but, no go). If we can reduce some security in Outlook to allow it to contain <SCRIPT> tags and run OnClick events then that's ABSOLUTELY FINE - as we are securely behind several firewall systems and this whole project is run internally only. I've also wondered if I could hide the COM code in a server-based Outlook custom form? I haven't used Outlook forms much yet but it that's the only way, I'll learn!

Many thanks for your time
Gar
 
K

Ken Slovak - [MVP - Outlook]

Secure versions of Outlook are going to block any script from running
in an HTML message, that's one way viruses can get propagated.

Outlook custom forms can do what you want and if published in the
Organizational Forms Library in Exchange Server are available to
anyone in your organization. If you aren't using Exchange Server each
user would have to have the form published in their Personal Forms
Library.

See http://www.slipstick.com/dev/forms.htm for information to get you
started with custom Outlook forms. Also, posting programming questions
in the outlook.program_forms or outlook.program_vba newsgroups will
get you faster answers since the development types hang out there.




Gary Forsyth said:
I have a simple enough request I think but cannot find a solution. I
have a VB6 app that extracts data from SQL and creates Outlook email
messages that are sent to staff inside our corporation. The receiver
needs to be able to click on various items in the email body and these
should somehow pass parameters to a local COM object that is installed
on every computer. I have been using HTMLBody content and constructing
HTML code with the items listed.
The problem is that whenever I add anything resembling client-side
scripting code (to access the local COM object) 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 said:
I can't even add a <A OnClick=...> tag. <A> tags with "OnClick" events don't work either.

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 local 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? I've even
considered using IFRAMES in the HTMLBody as these can contain other
HTML pages, but again I can't figure out how to pass information to
the IFRAME from a simple <A> tag (I've tried naming the IFrame and
setting the <A> tag target to the iframe name but, no go). If we can
reduce some security in Outlook to allow it to contain <SCRIPT> tags
and run OnClick events then that's ABSOLUTELY FINE - as we are
securely behind several firewall systems and this whole project is run
internally only. I've also wondered if I could hide the COM code in a
server-based Outlook custom form? I haven't used Outlook forms much
yet but it that's the only way, I'll learn!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top