View Full Version : Auto Item Send Error
Awhile back, I set up a program to auto send email. A day or so ago the IT dept had to do some resetting. Now, instead of auto mailing one letter with attachment after another I'm getting a prompt asking me that the program is trying to automatically send email on my behalf and do I want to allow this?
Any ideas on how to reset this @##*!!# rule??
Thanks,
Tom
As a side note, I considered using a "SendMail" command line BUT it would require a larger rewrite (which I may have to do anyway)
CreganTur
11-24-2008, 06:53 AM
I'm guessing you're using Outlook. What you're seeing is a standard security warning that occurs whenever automation tries to take over Outlook to create a new e-mail. The only way to get rid of it is to install a patch to Outlook... but most IT departments won't install it because of security risks- it completely turns off the warning, so a virus could send e-mails without warning.
The following code uses the ShellExecute API to create a new e-mail message. Since it doesn't directly interface with Outlook you may be able to use it to create your e-mails without the warning appearing.
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Const SW_SHOW As Long = 5
Sub SendEmail(strTo As String, strSubject As String, strBody As String)
Dim rc As Long
Dim strFile As String
'build the lpFile argument
strFile = "Mailto:" & strTo
strFile = strFile & "?subject=" & strSubject
strFile = strFile & "&body=" & strBody
rc = ShellExecute(0, "open", strFile, "", "", SW_SHOW)
End Sub
Mavyak
11-26-2008, 02:30 PM
You can also download AutoIT and run the follwoing script concurrently with your existing script and it will click the necessary controls to allow access to Outlook for 10 minutes every ten minutes until you cancel it or fail to answer it for a certain period of time:
$result = -1
$x = 0
While $result = -1
If WinActive("Microsoft Office Outlook") Then
WinActivate("Microsoft Office Outlook");
ControlClick("Microsoft Office Outlook", "", "[ID:4771]")
Sleep(500)
ControlCommand("Microsoft Office Outlook", "", "[ID:4773]", "SelectString", '10 Minutes')
Sleep(1000)
WinActivate("Microsoft Office Outlook")
Send("{TAB}")
Sleep(1000)
Send("{TAB}")
Sleep(1000)
Send("{ENTER}")
Sleep(500)
$result = MsgBox(36, "Success!", "Success", 10);
If $result = -1 Then
Sleep(570000)
EndIf
Else
If $x < 101 Then
Sleep(5000)
$x = $x + 1
Else
$result = MsgBox(36, "Awaiting Security Popup", "Continue waiting?", 10)
If $result = 6 Then
$result = -1
$x = 0
EndIf
EndIf
EndIf
WEnd
CreganTur
11-26-2008, 02:42 PM
There's also an article on the freeware ClickYes utility (http://vbaexpress.com/forum/showthread.php?t=16364) that does the same thing, just without you C&Ping the script code required for Auto IT.
If the API ShellExecute method works for you, then that would be a slightly better alternative because it will use fewer resources than having a concurrently running utility app to deal with the message.
Food for thought.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.