Automate Outlook directly with no
"a program is trying to automatically send email"
Security Manager
for Microsoft Outlook
Add-in Express Home > Outlook Security Manager > Online Guide > A program is trying to automatically send e-mail
Outlook automation
Here you can find code samples to automate Microsoft Outlook directly with no irritating messages or prompts like a program is trying to automatically send e-mail on your behalf.
With Outlook Security Manager you will need just a few lines of code to eliminate such alerts in Outlook 2000 - 2007. VBA, VB .NET, C#, C++, Visual Basic 6, Delphi, Word MailMerge, etc. are supported.

You can find this example in the Demo Projects\SendMail subfolder of the "Outlook Security Manager" folder. It illustrates how to use Outlook Security Manager from any application that automates Outlook. With this sample project you can send e-mail messages using Microsoft Outlook as a "mail engine". In this project there is a form, a simplified copy of the Outlook Mail window, with an Outlook Security checkbox.
If you check this option, you disable Outlook Security and your application sends messages with no security warnings. Otherwise, you get a notorious security pop-up dialog box: "a program is trying to send an e-mail..."

To disable Outlook Security we use the DisableOOMWarnings property. But here is one peculiarity. To use Outlook Security Manager from inside of your Outlook Automation application you should connect it to the Outlook.Application object used in your application. So, you use the ConnectTo method of the TOlSecurityManager class. For example (you can find the following in the code below the form):
Dim SecurityManager As New AddinExpress.Outlook.SecurityManager
SecurityManager.ConnectTo(outlookApp)
SecurityManager.DisableOOMWarnings = True
Try
'... any action with protected objects such as contacts or items...
Finally
' In any case please remember
' to turn on Outlook Security
' after your code, since now
' it is very easy to switch it off! :-)
SecurityManager.DisableOOMWarnings = False
End Try
Visual Basic 6 (VBA)
OlSecurityManager.ConnectTo OutlookApp
OlSecurityManager.DisableOOMWarnings = True
On Error Goto Finally
'... any action with protected objects ...
Finally:
OlSecurityManager.DisableOOMWarnings = False
Delphi
OlSecurityManager.ConnectTo(outlookApp);
OlSecurityManager.DisableOOMWarnings := True;
try
//... any action with protected objects ...
finally
OlSecurityManager.DisableOOMWarnings = False;
end;
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 turned Outlook Security on 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.
>> Deployment |
Back to Outlook Security Manager homepage

