Is there a way to prevent autoresolve in outlook?

十年热恋 提交于 2019-12-12 14:21:05

问题


I am sending email by automating outlook from excel and have managed to bypass the pesky warning message about viruses using sendkeys (with inspector activate just prior to call to sendkeys).

Now I sometimes get a message about allowing access to contacts. I have the email addresses for the recipients and don't need to access the contacts, but outlook autoresolve kicks in and then a pop up about allowing access to the contacts appears. This doesn't have the 5 second delay, but it still prevents the system being fully automated. I'm trying to avoid using 3rd party tools like redemption and I was wondering if anyone has found a way to turn autoresolve off.

I've read posts on other sites suggesting turning off autocomplete and automatic name checking, but outlook still attempts to resolve the address when the mail is sent.

Any pointers would be gladly received.

Edit 24/08/13

I have heard that if you outlook 2007 and above and a correctly installed system with a Microsoft approved virus scanner you will not see the message, but I don't have control over the installation of programs on the users machines.

The code that I have tried includes

Function Mailit(byval sMessageTo as String, byval sSamplerCenter as String, byval sFileSpec as String)

Dim olApp As outlook.Application
Dim objMail As Outlook.MailItem
Dim blnOLOpen As Boolean

    On Error Resume Next
    Set olApp = GetObject(, "Outlook.Application")
    blnOLOpen = True
    On Error Goto 0

    If olApp Is Nothing Then
        Set olApp = CreateObject("Outlook.Application")
        blnOLOpen = False
    End If

    Set objMail = olApp.CreateItem(olMailItem)

    With objMail
       .To = sMessageTo
       .Subject = sSampleCenter
       .Attachments.Add sFileSpec
       .Send
    End With

This causes the warning message about viruses and causes a 5 second wait before a user can choose to send the mail. The sendkeys method I use is the same up to the With objMail but then does the following:

Dim myInspector As Outlook.Inspector


With objMail
.To = MessageTo
.Subject = SampleCenter
.Attachments.Add FileSpec
.Display
End With

Set myInspector = objMail.GetInspector
myInspector.Activate
SendKeys "%s", True

I also have some code for checking that the number of items in the sent folder has increased and waiting/calling the inspector and sendkeys function if it hasn't. This method doesn't lead to the warning, but often results in a dialog box asking if the user wishes to allow access to their contacts.


回答1:


In Outlook: Go to Options -> E-Mail and disable the checkbox "Resolve names automatically".



来源:https://stackoverflow.com/questions/18413477/is-there-a-way-to-prevent-autoresolve-in-outlook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!