Automate Outlook 2019, 2016, 2013 and earlier without
"a program is trying to automatically send email"
With Outlook Security Manager you need just a few lines of code to eliminate alerts like a A program is trying to automatically send email on your behalf in Outlook 2019, 2016, 2013, 2010 and earlier versions.
This example shows how to use Security Manager from an application that automates Outlook. You can also see the code samples (VBA, VB.NET, Delphi) to automate Microsoft Outlook. With this application you can send messages using Outlook as a "mail engine". In this project there is one form mimicking the Outlook Mail window with an Outlook Security check box.
If you check this option, you disable Outlook Security and your application sends messages with no security warnings. Otherwise, you get one of these notorious security pop-up dialog boxes:
As well as in the example that disabls A program is trying to access e-mail addresses you have stored in Outlook alert, protected Outlook objects are used here. To disable Outlook Security, we use the DisableOOMWarnings property. But there is one peculiarity here. To use Outlook Security Manager inside an application interacting with Outlook you should connect it to Outlook.Application used by this application. To do this you can use the ConnectTo method of the SecurityManager class. For example:
Visual Basic .NET
Visual Basic 6 (VBA)
Thus, if you want to disable Outlook security, use Outlook Security Manager and call the ConnectTo method before disabling Outlook Security.
Please, make sure that you turn on Outlook Security inside the "finally" section, because Outlook Security Manager can potentially open a door for unsafe content. To avoid this you must enable Outlook security within a protected finalization code after each elementary call of the protected objects as we have showed in this example.