Last post Jul 25, 2007 01:55 PM by gunteman
Jul 24, 2007 04:49 PM|kotor2000|LINK
I'm trying to do a web application that will take the info passed by the user, generate an report with excel and automatically send a mail throught outlook. I used vbscript to generate the mail. All works fine on localhost, but on server, I get the
following error: ActiveX component can't create object 'outlook.application'.
my code :
stradress = reponse
.Subject = subject
.Importance = olImportanceHigh
.To = StrAdress
I tried to grant access to asp.net and network service to the registrykey given by the error message when I try to create an outlook object in server-side code but without success.
Any help would be great!
Jul 24, 2007 04:59 PM|gunteman|LINK
There doesn't seem to be any ASP.NET involved. In fact, by the looks of your code your are executing this client side (in the browser). Is the webpage in a trusted zone?
Jul 25, 2007 08:25 AM|kotor2000|LINK
Actually, I call the script from the server side of my web application builted with VB.net 2005 like :
strScript = "<script language='vbscript'>"
& vbCrLf & "Call SendMailAuto(""" & custAdresse &
""",""" & message1 &
""",""" & "Shipment for: " & custName &
""",""" & message2 &
""",""" & strfilePath &
"""" & ")"
& vbCrLf & "</script>"
I think I have a bad approach. I never code something like that in .net. It was important for the users toactually see the outlook window before sending the mail so I did something I knew was working in vb6 and try to adapt it but I consider
now using the built-in function of .net to do this.
To answer to your question, no the website isn't in trusted zone.
If you have any suggestion, I will be glad to hear it.
Jul 25, 2007 08:50 AM|gunteman|LINK
Actually, I call the script from the server side of my web application builted with VB.net 2005 like ....
I think I have a bad approach. I never code something like that in .net. It was important for the users toactually see the outlook window before sending the mail so I did something I knew was working in vb6 and try to adapt it but I consider now using the built-in
function of .net to do this.
Jul 25, 2007 10:37 AM|kotor2000|LINK
Thanks for the quick reply!
well it seems to be important for the users to see the outlook display. The users here are specific with their needs. They want to be able to see the attachement files before the sending and to be able to change some parameters just before the sending. I
thought about coding some forms that would show the info and files before sending the mails, but all the users here use outlook and they don't think my application would be friendly-user. Way to go for the vote of confidence. Anyway, I know it is something
about permissions, but I didn't want to give too much permissions to ASP.NET since it is on an important server here. So, it seems I'm stuck. They will have to deal with a mail form.
Thanks for your help
Jul 25, 2007 01:55 PM|gunteman|LINK
You don't have to give permissions to ASP.NET. It's a matter of making the clients (Internet Explorer) trusting the website enough to lower the ActiveX security settings for this specific website.
Also, your approach requires that the attachment is stored locally on the user's computer. Is it?
You could possibly use an advanced mailto link as well, but I'm not sure how Outlook behaves with attachments.
I would still go for a nice mail form though...