How to turn off Microsoft Outlook security warnings

When I send an email through my VB6 MAPI application, I get to warning messages from Outlook;

Another program is trying to access email addresses you have stored in Outlook…
Press “Yes” to allow

A program is trying to automatically send email on your behalf
Press “Yes” to allow

Is there a way to bypass \ avoid these warning messages?

Thanks in advance,
Who is Participating?
ashunigamConnect With a Mentor Commented:
Sorry about that here is a free tool to click on your behalf that may help... from another tip from tek-ltip site.

In previous code try after removing line Turn_Off_Auto_YES             

The security dialogs that pop up when an application tries to access certain Outlook properties and methods are designed to inhibit the spread of viruses via Outlook; see

If you are a standalone user, Outlook provides no way to suppress this behavior. However, you can use a free tool called Express ClickYes:
to click the security dialog buttons automatically. Beware that this means if a virus tries to send mail using Outlook or gain access to your address book, it will

If you're the administrator in an Exchange Server or HP OpenMail environment, you can reduce the impact of the security prompts with administrative tools. See

If it's an application you wrote yourself, normally you can use one of these approaches to redo the program:

 -- Use Extended MAPI
see and C++
or Delphi; this is the most secure method and the only one that Microsoft recommendeds.

 -- Use Redemption
a third-party COM library that wraps around Extended MAPI but parallels the Outlook Object Model

 -- Use SendKeys to "click" the buttons on the security dialogs that your application may trigger. See
for a link to sample code.

 -- Program the free Express ClickYes
to start suspended and turn it on only when your program needs to have the buttons clicked automatically.

Source: Sue Mosher, Outlook MVP
There is a code link to bypass the message
for your ease

' Declare Windows' API functions
Private Declare Function RegisterWindowMessage _
        Lib "user32" Alias "RegisterWindowMessageA" _
        (ByVal lpString As String) As Long

Private Declare Function FindWindow Lib "user32" _
        Alias "FindWindowA" (ByVal lpClassName As Any, _
        ByVal lpWindowName As Any) As Long

Private Declare Function SendMessage Lib "user32" _
        Alias "SendMessageA" (ByVal hwnd As Long, _
        ByVal wMsg As Long, ByVal wParam As Long, _
        lParam As Any) As Long

Private Sub Turn_Auto_Yes_On()
Dim wnd As Long
Dim uClickYes As Long
Dim Res As Long
uClickYes = RegisterWindowMessage("CLICKYES_SUSPEND_RESUME")
wnd = FindWindow("EXCLICKYES_WND", 0&)
Res = SendMessage(wnd, uClickYes, 1, 0)
End Sub

Private Sub Turn_Off_Auto_Yes()
Dim wnd As Long
Dim uClickYes As Long
Dim Res As Long
uClickYes = RegisterWindowMessage("CLICKYES_SUSPEND_RESUME")
wnd = FindWindow("EXCLICKYES_WND", 0&)
Res = SendMessage(wnd, uClickYes, 0, 0)
End Sub

Sub Send_Mails()
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem

'Enables automatic "YES" clicks for Outlook
Turn_Auto_YES_On               '******************

'set variables for Outlook and a message
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
        .To = "Name of recipient"
        .Subject = "Subject Goes Here"
        .HTMLBody = "This could be a title<br><br>message body and instructions<br>could go here"
        .Attachments.Add "Path & Filename", olByValue, 1, "Filename To Display"
    End With

'Turns off the Auto_Yes program
Turn_Off_Auto_YES                    '**********************
Set MailOutLook = Nothing
Set appOutLook = Nothing
End Sub
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

JohnFraAuthor Commented:
Thanks ashunigam, I tried your code but I still get the message "A program is automatically trying to send e-mail.. " And the YES is still required to continue :(
Outlook: How do I suppress Outlook’s warning message “Someone is trying to send a mail on your behalf  …. ”
Hi Dhaest
Just for your information. link is already part of my posting, that is suggested by you in link above.

Answered by ashunigam
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.