开发者

How can I open other people's Outlook from asp.net?

开发者 https://www.devze.com 2023-03-19 04:34 出处:网络
I开发者_开发问答 am using Dim Outl As Object Outl = CreateObject(\"Outlook.Application\", \"localhost\")

I开发者_开发问答 am using

    Dim Outl As Object
    Outl = CreateObject("Outlook.Application", "localhost")

    If Outl IsNot Nothing Then
        Dim omsg As Object
        omsg = Outl.CreateItem(0) '=Outlook.OlItemType.olMailItem'
        'set message properties here...'
        omsg.Display(True) 'will display message to user
    End If

to open outlook but when i host application in iis i got error "Cannot create ActiveX component." i welcome all suggestion..


What you're trying to do is what many virus and malware authors have tried to do. Consequently I don't believe you can. Outlook will block your attempt as it thinks it's malicious.

It may work if the server is running in a trusted zone, but the user will need to change their local IE settings to add your website. If you're trying to show a mail item, try using a href=mailto: instead. it's possible to specify subject & body in the link.

Simon


Winforms apps (like Outlook) launched in service process will be displayed on an invisible virtual screen. You will only be able to see the side effects of the applications actions, i.e. sending an email.

Also, is this ASP.NET or ASP classic? That CreateObject reminds me more of ASP classic than .NET

You didn't show the rest of the code... If this is not server side code, but instead say a client side VB script sent to the user in HTML, then you will need to sign your code, the user will have to do a lot of configuration to trust your code to launch an ActiveX component. Launching an ActiveX component as if it were a Java Applet is kind of a security risk, since ActiveX, at least originally, wasn't designed to be carefully sandboxed. (But times may have changed, I haven't looked at client side ActiveX embedded in HTML in years)

0

精彩评论

暂无评论...
验证码 换一张
取 消