disable outlook security dialogue box (1 Viewer)

grapevine

Registered User.
Local time
Today, 15:22
Joined
Feb 21, 2009
Messages
39
I have successfully managed (with help from forums) to write some code to send a report to Outlook, but the security dialog box in Outlook keeps appearing requiring user intervention.
I have found various bits of code on the system, but they all seem to be packages that you have to pay for.
I am using Outlook 2010 - is there some code that I can write into my Access VBA module that will either automate the clicking of the Allow button or stop the dialog box from appearing altogether when the report runs.
The report is being called from the Task Scheduler and it rather defeats the objective if someone needs to be at the desk to click Allow in order for the report to be sent.
Any guidance or advice, gratefully received.
Many thanks

current code in Access which is working but brings up Outlook Security Dialog box
Code:
Public Function ReviewDate()
Dim TR As String
Dim criteria As String
Dim trnum As Integer
trnum = DCount("[Date for Review]", "qryTrainingDueReviewDate")
If trnum > 0 Then
DoCmd.SendObject acSendReport, "RptTrainingDueReviewDate", acFormatPDF, "abc@emailaddress", , , "Outstanding Review Dates", "Please find list of outstanding or due review dates for various training courses", False
Else
DoCmd.SendObject , , , "abc@emailaddress", , , "Review Dates", "There are no training records needing reviewing", False
End If
End Function
 

spikepl

Eledittingent Beliped
Local time
Today, 16:22
Joined
Nov 3, 2010
Messages
6,142
To work around this problem, you can customize the behavior of the Outlook E-mail Security Update. You can customize the behavior only if you are running Outlook in a Microsoft Exchange Server environment, and your e-mail messages are delivered to a server-based mailbox.
from http://support.microsoft.com/kb/263084

You haven't mentioned your environment.

There is CDO to bypass Outlook alltogether (free) http://www.access-programmers.co.uk/forums/showthread.php?t=224980, or Redemption (not free) if you insist of Outlook , google it, or this http://www.mapilab.com/outlook/security/ (free), or there is a program, not free, that clicks Allow for you.

This is an industry conspiracy - Microsoft make a feature, so that you then have to pay others to remove it :D
 
Last edited:

grapevine

Registered User.
Local time
Today, 15:22
Joined
Feb 21, 2009
Messages
39
I will have a look a the CDO script - I have never used it before. I am writing the code at home on Outlook 2012 on a non exchange environment
It will be implemented on Outlook 2012 on Exchange Server 2003.
Will I need to amend the code in order for it to run here and then when I load it onto the clients machine?
Many thanks
 

spikepl

Eledittingent Beliped
Local time
Today, 16:22
Joined
Nov 3, 2010
Messages
6,142
Before embarking on coding, since you do use the exchange server, I'd recommend first reading the linked Microsoft KB very carefully
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:22
Joined
Aug 30, 2003
Messages
36,133
Will I need to amend the code in order for it to run here and then when I load it onto the clients machine?

If you go the CDO route, it should work on the clients machines, but you'd likely need to amend it to use their server and login info.
 

grapevine

Registered User.
Local time
Today, 15:22
Joined
Feb 21, 2009
Messages
39
Thank you Spikepl for your advice which I am now about to start reading and trying to implement on my home machine initally, but what is the "linked microsoft KB" that you refer to?
 

grapevine

Registered User.
Local time
Today, 15:22
Joined
Feb 21, 2009
Messages
39
Thank you pbaldy for your help and assistance, I will get it (try to get it) working on my home machine first and then I will probably need to post again to find out what I need to amend / find out from my clients when I install on their machine.
I am sure I will be posting again for advice from both you and spikepl as I go down this CDO route which is totally new to me.
 

grapevine

Registered User.
Local time
Today, 15:22
Joined
Feb 21, 2009
Messages
39
It appears that I am falling at the first hurdle. The = before the first email address comes up as a compile error (Expected: list separator or ) ) although the system has let me change the Optional Byval information. Should I be passing the email address to the code? Just to recap, I have the Task Scheduler calling a macro with the Action RunCode which is calling this code and currently is not passing any arguments. Action - Run code, argument - reviewdate()
Do I need to comment out any lines of code to run on my home machine which I will need to comment in when (if) I get it working on the server version?
Any help really gratefully received.


Code:
Public Function ReviewDate(ByVal sTo As String = "[EMAIL="abc@emailaddress"][COLOR=#0066cc]abc@emailaddress[/COLOR][/EMAIL]", ByVal sFrom As String = "[EMAIL="abc@emailaddress"][COLOR=#0066cc]abc@emailaddress[/COLOR][/EMAIL]", _
Code:
Option Compare Database
Option Explicit
Private Const URL_CDOCONFIG As String = "[URL]http://schemas.microsoft.com/cdo/configuration/[/URL]"

Public Function ReviewDate(ByVal sTo As String = "[EMAIL="abc@emailaddress"]abc@emailaddress[/EMAIL]", ByVal sFrom As String = "[EMAIL="abc@emailaddress"][COLOR=#0066cc]abc@emailaddress[/COLOR][/EMAIL]", _
        Optional ByVal sCC As String = "", Optional ByVal sBCC As String = "", _
        Optional ByVal sSubject As String = "Review Report", Optional ByVal sBody As String = "Please find attached the report containing overdue review dates or those expiring within the next 60 days", _
        Optional ByVal sServer As String = "smtp.uwclub.net", Optional ByVal iPort As Integer = 587, _
        Optional ByVal sUsername As String = "[EMAIL="abc@emailaddress"][COLOR=#0066cc]abc@emailaddress[/COLOR][/EMAIL]", Optional ByVal sPassword As String = "mypassword", _
        Optional ByVal iSendUsing As Integer = 2, Optional ByVal bAuthenticate As Boolean = True, _
        Optional ByVal bUseSSL As Boolean = True, Optional ByVal iTimeout As Integer = 60) As Boolean
        
    On Error Resume Next
    Err.Clear
    Dim cdomsg As CDO.Message
    Set cdomsg = CreateObject("CDO.message")
    If Err Then
        Debug.Print Err.Description
        SendEmail = False 'Message not sent
    Else
        With cdomsg
            With .Configuration.Fields
                .Item(URL_CDOCONFIG & "sendusing") = iSendUsing
                .Item(URL_CDOCONFIG & "smtpserver") = sServer
                .Item(URL_CDOCONFIG & "smptserverport") = iPort
                .Item(URL_CDOCONFIG & "smtpauthenticate") = IIf(bAuthenticate, 1, 0)
                .Item(URL_CDOCONFIG & "smtpusessl") = bUseSSL
                .Item(URL_CDOCONFIG & "smtpconnectiontimeout") = iTimeout
                .Item(URL_CDOCONFIG & "sendusername") = sUsername
                .Item(URL_CDOCONFIG & "sendpassword") = sPassword
                .Update
            End With
            .To = sTo
            .From = sFrom
            .CC = sCC
            .BCC = sBCC
            .Subject = sSubject
            .TextBody = sBody
            If Err Then
                Debug.Print Err.Description
                SendEmail = False 'Message not sent
            Else
                DoCmd.Hourglass True
                .Send
                DoCmd.Hourglass False
                If Err Then
                    Debug.Print Err.Description
                    SendEmail = False 'Message not sent
                Else
                    SendEmail = True 'Message sent
                End If
            End If
        End With
        Set cdomsg = Nothing
    End If
End Function
 

ghudson

Registered User.
Local time
Today, 10:22
Joined
Jun 8, 2002
Messages
6,195
Do not use the DoCmd.SendObject method. Search for CreateObject("Outlook.Application") and you should find some examples on how to send emails that avoid the outlook security warnings.
 

Users who are viewing this thread

Top Bottom