Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    13

    Unanswered: Outlook 2003 Security Message on SendObject

    Does anyone know how to disable the Outlook 2003 Security Message that appears when using the Docmd.SendObject function in Access?

    The message reads:
    "A program is trying to automatically send e-mail on your behalf. Do you want to allow this?"

    Apparently an attempt to mitigate virus propogation through email, buyt is there anyway to temporarily disable this function in VB to allow automated emails to be sent through an Access application?

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    It depends on the company that you work for. The IT department here will not allow that functionality to be disabled. I get around the problem by using the Outlook object rather than SendObject. I then display the message and use SendKeys to 'push' the send button on the displayed message. The user can't use their PC while the code is running, but they prefer this work around to pushing the OK button on the Outlook warning message for every email. They usually push a button to run the code then go for coffee or lunch or start the code just before going home and having it run over night.

    Other issues to wach for:
    Turn off spell check - things like part numbers and supplier/customer codes can cause problems.

    Scrub your email addresses - check the format before creating the email, Outlook can check the format of email addresses before sending and if your address fails outlooks test, it will stall the code.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Yes, I've dealt with this problem extensively. I might recommend using an emailing client program such as Blat (just to send these type of emails - you can still utilize Outlook for other stuff) which doesn't produce this message when sending attachments (and is very easy to code against in vba - only a dozen lines of code which I can supply you (I also posted this code in a post several months back).) Other than getting the IT department to disable this feature (which they most likely will not do as it is not an easy process) or utilizing SendKeys as rogue stated, I never found a way around this message being produced. It's a "feature" I highly disagreed with Microsoft adding with one of the service packs installed. I saw no real value for developers with this added annoying message. You may want to search these posts on this Outlook message as I posted some threads several months back which thoroughly describe this (I believe it was actually about a year ago.) Sadly and dissappointingly on Microsoft, there is no easy way to temporarily disable it for sending certain emails (I searched high and low for a way to do this without any success.)

    But Blat has worked excellent for me in handling emailing of attachments and Blat is free and very easy to install and code in for vba. It worked without interferring in any Outlook settings or normal operations.

    Here's another post I found on the subject:
    azadeh03-14-04, 01:32
    I had the same problem as yours. I downloaded a small program from Internet which sends and a click event for Yes Button of this dialog box.Address of its web site is "http://www.express-soft.com/mailmate/clickyes.html". But I have another problem which I cannot use /a and /m switch for the outlook.exe in command line because I would like to send a large number of emails with different attachments. I tried to do this through a program but the mail server had some problems which I didn't succeed to do so but with outlook I could send email from that mail server.If you have any suggestion , I would be glad to hear.

    Andronicus08-12-04, 16:50
    That web paged saved my life!!!! (well maybe not my life but a lot of sleep)
    Is there any other way (more normal way like say changing settings) to get rid of this security "feature"?
    I had the same problem as yours. I downloaded a small program from Internet which sends and a click event for Yes Button of this dialog box.Address of its web site is "http://www.express-soft.com/mailmate/clickyes.html". But I have another problem which I cannot use /a and /m switch for the outlook.exe in command line because I would like to send a large number of emails with different attachments. I tried to do this through a program but the mail server had some problems which I didn't succeed to do so but with outlook I could send email from that mail server.If you have any suggestion , I would be glad to hear.

    And perhaps these links will help:
    http://www.dbforums.com/showthread.php?threadid=885870

    And an example of code utilizing Blat:
    pkstormy 01-20-06, 11:46
    We used to use the sendobject command but Outlook kept coming up and asking if the user still wanted to send the attachment and the user had to select yes or no.

    We now use blat and send the report as a snapshot attachment which seems to work very well. blat I believe is free and fairly easy to install. Here's what our code looks like to send the email (getuser gets the user's login - see my post on getting the user's login):

    Public Sub SendEmail(ToVar As String, EmailAttch As String, PONumber As Variant)
    Dim FromVar, Server, FileToSend, OverrideBody, Subject As String
    FromVar = GetUser() & "@weccusa.org"
    Subject = "POReportEmail - " & PONumber
    OverrideBody = "Purchase Order Billed To Muni/Co-op"
    Server = "linux2.weccusa.org"
    FileToSend = "\\SQLServer\Databases\Databases\blatEmail\message . txt"

    Dim x As String

    'send email

    p_blat_location = "\\SQLServer\Databases\Databases\blatEmail\blat.ex e "

    'MsgBox (Attachment)
    'MsgBox EmailAttch

    x = p_blat_location & " " & FileToSend & " -s " & Chr(34) & Subject & Chr(34) & _
    " -t " & ToVar & " -f " & FromVar & " -server " & Server & " -attach " & EmailAttch

    'x = p_blat_location & " " & FileToSend & " -s " & Chr(34) & Subject & Chr(34) & _
    ' " -t " & ToVar & " -f " & FromVar & " -server " & Server & " -attach \\SQLServer\Databases\Databases\PurchaseOrders\POE mails\17725.snp"

    If Len(OverrideBody) > 0 Then
    x = x & " -body " & Chr(34) & OverrideBody & Chr(34)
    End If

    'debug
    x = x & " -debug -log c:\blat.log -timestamp"

    'MsgBox x
    'Debug.Print x

    'Shell x, vbHide

    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "cmd.exe /c " & x, 0, True
    Set WshShell = Nothing

    End Sub

    Another solution (although may not be the prettiest), is to write the data/report into the actual message area of the email versus as an attachment.
    Last edited by pkstormy; 07-15-08 at 23:21.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Or don't use blat and just bypass Outlook entirely.

    http://www.dbforums.com/showthread.php?t=1626609
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •