I need to disable the Outlook warning "A program is trying to automatically send email on your behalf"

I have vb written that sends an email from Access, and that is all well, but when it goes through Outlook I get the warning "A program is trying to automatically send email on your behalf". I have looked at many, many, many, many sites that have tips and tricks to get around this, and it all seems WAY too complicated. Isn't there an easier way, through code or something? A detailed description of how to accomplish this will be very much appreciated. Thanks.
Who is Participating?
Closed, 250 points refunded.
Site Admin
Steve BinkCommented:
Nope, no easier way.  That warning is now built in to Outlook to do exactly what it is doing.  The CDONTS work-around is the easiest I've seen.
Steve BinkCommented:
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Steve BinkCommented:
Here's more information on what affects the update has:

there are "simple mapi" modules out there that send email without using outlook at all and are easy to use.


horstuffAuthor Commented:
Steve, do you know if the mapi modules will work with an html email? The bottom line on all this is that I need to send .html invoices to customers, and I figured the best way would be to create an html email from the same report that makes them a paper invoice. I have that setup in my code, it look something like this:

Private Sub cmdBBmail_Click()

'You have to output your Report and save it on a disk drive.
'You can do it with HTML to maintain the Report Format.

    DoCmd.OutputTo acOutputReport, "Invoice - with SKU and Options_HTML_Email", acFormatHTML, "c:\Invoice - with SKU and Options_HTML_Email.HTML", False

'Now we will open this file and read the contenet of it in a String Variable called FullText

Dim MyString
Dim FullText As String
Open "c:\Invoice - with SKU and Options_HTML_Email.HTML" For Input As #1    ' Open file for input.
Do While Not EOF(1)    ' Loop until end of file.
    Line Input #1, MyString    ' Read each Line into MyString variable.
    FullText = FullText & MyString     'Put all the Lines read into one String, FullText
Close #1    ' Close file.

'In Outlook, go to Tools>Option>Mail Format>HTML (use this message format)
'Why HTML, because the base of it is Text, but the output is formated HTML
'We need to have a String to put in the .HTMLBody, not a file

Dim ol As New Outlook.Application
Dim olMail As Outlook.MailItem

    Set olMail = ol.CreateItem(olMailItem)

    With olMail
        .To = "test@mysite.com"
        '.CC = strCC
        '.BCC = "address2@aa.com"
        '.Attachments.Add "c:\somefile.txt"
        '.Attachments.Add "c:\somefile2.txt"
        .Subject = "Testing"
        .HTMLBody = "<img src='http://mysite.com/OM_data/email_logo.gif'>" & FullText 'c:\CVPrint1.HTML"
        '.Body = "This is the body..."
    End With

    Set olMail = Nothing
    Set ol = Nothing
End Sub
I have not tried it but I image that the HTML formatting has more to do with how the recipient has thier email client set up that what you have yours set up as. It is very easy to try out, just own load the zip file, unzip and add the classes direcftly into your database.

horstuffAuthor Commented:
how do I add the classes to the .mdb? References? If so, which ones (not all 7???)
just the .cls and .bas files

from any code window use the Insert --> File Menu.
comment out anything that now displays red.

horstuffAuthor Commented:

I may be stupid, but how the hell do you add these things? I am trying to add them and it creates a new mod called modMain, then the file.cls gets inserted into it, but it has an invalid procedure where it says OPEN, then I try to install it as a new module, then it crashes, etc etc etc. Could you maybe be a bit more detailed in your instruction? Thanks.
horstuffAuthor Commented:
as I add the .cls files, it errors an Invalid outside procedure on the word Begin at

  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior = 0   'vbNone
  MTSTransactionMode = 0   'NotAnMTSObject

Steve's method is undoubtedly the better one if you can get it to work, but I've been using a program called "Express ClickYes" to get through those e-mail notifications.  It's available at http://www.contextmagic.com/express-clickyes/, and seems to work just fine.  That page gives instructions on how to activate and suspend the service (so other programs can't send e-mail when you're not expecting it), though I tend to shut the program off entirely when I'm not using it... just to be safe.
comment anything that is now displayed in red.
horstuffAuthor Commented:

It ain't happening. I AM commenting out anything in red. Thanks anyway
horstuffAuthor Commented:
Well, I figured it out another way. How do I close this question?
Steve BinkCommented:
Just a reminder, from my first comment:

>>> Nope, no easier way.  That warning is now built in to Outlook to do exactly what it is doing.  The CDONTS work-around is the easiest I've seen.

You can post a request to close this question and refund your points at:


Also, if you have generated a solution yourself, please post it for the benefits of those who will see this question later.
horstuffAuthor Commented:
The solution involved Redemption.dll

Dim Application As Outlook.Application
Dim NameSpace As Outlook.NameSpace
Dim Sync

Set Application = CreateObject("Outlook.Application")
Set NameSpace = Application.GetNamespace("MAPI")
Set Sync = NameSpace.SyncObjects.Item(1)

Dim SafeItem, oItem, Btn
Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = Application.CreateItem(0)
SafeItem.Item = oItem
SafeItem.Recipients.Add "me@mysite.com"
SafeItem.Subject = "Testing Redemption"
SafeItem.HTMLBody = "<img src='http://mysite.com/email_logo.gif'>"
Set Btn = Application.ActiveExplorer.CommandBars.FindControl(1, 5488)
'Set Btn = Application.CommandBars.FindControl(1, 5488)
End Sub
Steve BinkCommented:
What is redemption.dll?  What does this line do:

Set Btn = Application.ActiveExplorer.CommandBars.FindControl(1, 5488)
horstuffAuthor Commented:


that line is a workaround to execute send/recieve in outlook. It is kind of clunky, but it works. I couldn't figure out any other way to get the thing to send (otherwise it just sits in the drafts folder).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.