How to avoid an Outlook security warning when sending an Outlook message from VBScript?

I have this situation:

  • The code must be in VBScript (out of my control)
  • It is impossible to disable software access restrictions in Outlook settings (group policy, not admin and Windows will not recognize a valid anti-virus scanner installed)
  • You cannot use SMTP because it is prohibited.

I thought there would be no way to send an email using Outlook in an automatic way (in an automatic window registered as a user with a locked screen). I tried many different approaches, but always got a security warning. How can i fix this?

I already tried everything on this useful site and excluded each option as follows:

Strategies
Ideally, Outlook automation applications should avoid code that runs these security hints.

This is exactly what I ended up doing (see my answer below), so all the other options on this page don't matter. Take them one by one:

Sending messages
There is no need to use Outlook objects at all, if your goal is to simply create and send an email message. Microsoft provides the CDO library for Windows to create and send messages with SMTP. Using this library completely bypasses Outlook and MAPI and does not cause security hints. For code samples see ...

SMTP. -. .

MAPI Outlook, Simple MAPI CDO 1.21 , .

MAPI , C/++ ( , . ), , , .

- Redemption MAPI33 - , . , MAPI, . , Outlook.

:  - ;  - , ( , );  - , , - , Outlook. , ? ... ? , , , . , , , , , .  - , .

.

, OMG, (. ).

Outlook 2007 , Outlook, CDO 1.21 Simple MAPI.

, , , Outlook . : " : . Windows , ".

Outlook, VBA Outlook COM Outlook.Application, VBA . , . VBA " script" .

, , , . Outlook , .

Outlook, "" COM , . Outlook 2007 Microsoft Exchange Server. Outlook 2007 . , .

: COM , .

, Exchange , API WebDAV, Exchange 2000 , Exchange 2007, - Exchange.

, , .

Outlook .

, // . COM, , , .

+5
2

Outlook 2010 . , , (, ), , , , , , .

, , , , .

: , MailItem.Send. , . ALT + s, , Outlook, "". , . , , , SendKeys, , , .

UIPI ( ):

Outlook 2010 , . , Windows , , Medium. UIPI "SendKeys", , . , - VBScript Outlook. , - , . Office, 2010.

Sub SendEmail_Outlook()
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set ol=CreateObject("Outlook.Application") 
    Set Mail=ol.CreateItem(0) 
    Mail.to= "you@example.com"
    Mail.Subject = "test"
    Mail.HTMLBody = "test"
    Mail.Display    
    WshShell.SendKeys "%s"
    Set Mail = Nothing 
    Set ol = Nothing 
End Sub

SendEmail_Outlook

, VBScript Windows. , " ", UAC ( "", ).

windows task scheduler properties

+9

:

. http://www.outlookcode.com/article.aspx?id=52 .

0

All Articles