Workaround email security message "...trying to automatically send e-mail on your behalf"

In Access2000, trying to automate some notifications in an unattended, scheduled process, using docmd.sendobject to send email gives message "A program is trying to automatically send email on your behalf...".  Is there any way to work around this or otherwise email from Access/VB?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


> In Access2000, trying to automate some notifications in an unattended, scheduled
> process, using docmd.sendobject to send email gives message "A program is
> trying to automatically send email on your behalf...".  Is there any way to
> work around this or otherwise email from Access/VB?

See this question:

Hope that helps,
This is what I use. Hope it helps. Combination of what I found and what I added (not much added really).

Function SendEmail(strTo, strMessage, strAttach, strSubject, strBCC)

   Set objEmail = CreateObject("CDO.Message")
      objEmail.FROM = ""
      objEmail.To = strTO '//// format ";"
      objEmail.BCC = strBCC
      objEmail.Subject = strSubject
      objEmail.TextBody = strMessage
      objEmail.AddAttachment strAttach
      objEmail.Configuration.Fields.Item("") = 2
      objEmail.Configuration.Fields.Item("") = ""
      objEmail.Configuration.Fields.Item("") = 25
      Set objEmail = Nothing

End Function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Team929 demonstrates how to go through proxies, - if you don't need this but prefer SMTP directly you can also do:

Public Function skMsgCDO()

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library

Dim iConf As New CDO.Configuration, iMsg As New CDO.Message, Flds  As ADODB.Fields
Dim skFromName As String, skFromAddr As String, skToName As String, skToAddr As String
dim skMailServer As String, skMailAccount As String

' Config for SMTP mail-account
    skMailServer = ""
    skMailAccount = "xx"

' Contents for the message
    skFromName = "Full Name"
    skFromAddr = ""
    skToName = "Full Name"
    skToAddr = ""
    skCC = "" ' just comma or semicolon separated e-mail address list
    skSubject = "Your lights are on, but no one is home"
    skBody = "You left your lights on this morning."

' Set the configuration for Network Send
    Set Flds = iConf.Fields
    Flds(cdoSendUsingMethod) = cdoSendUsingPort
    Flds(cdoSMTPAccountName) = skMailAccount
    Flds(cdoSMTPServer) = skMailServer
    Flds(cdoSMTPServerPort) = 25
    Flds(cdoSMTPConnectionTimeout) = 30

' Do the message
    Set iMsg.Configuration = iConf
    With iMsg
       .From = Chr(34) & skFromName & Chr(34) & skFromAddr
       .CC = skCC
       .Subject = skSubject
       .TextBody = skBody
       .To = Chr(34) & skToName & Chr(34) & skToAddr
       .Fields(cdoDispositionNotificationTo) = ""
    End With

' Finished
    Set iMsg = Nothing
    Set iConf = Nothing

End Function

Kind regards,
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Team 929,

In the Config.Fields.... can you explain the format? I understand most everything else, but am having a hard time following those three areas. Thanx

Let me try but like I said, I found it orignally somewhere and truncated and made it so that its easily accessable from anywhere in the code as long as you put in the required variables.

     Configuration.Fields.Item(...) = 2
This is the one I'm not all that sure about but from what I can gather and remember, its the way you send the email. Something like how 0 represents acImport, 1 is acExport and such.
      Configuration.Fields.Item(...) = ""
Obviously, it sets the name of the smtp server.
      Configuration.Fields.Item(...) = 25
This is the default port to be used. Much like how port 21 is the default port for FTP.

Hope this helps.

Team 929,

Hate to jump in this string, but I will give you points if I can grasp this idea as well. I am having the same issue. I am trying to use your function and I was wondering two things.

1- what is the Http's listed in the Configs
2- what references do I need to use this function

Hey... your code works great! Last question how can I attach an object out of my db now? =) last question promise. will give you points.
umm.. okay... I wonder where the original poster went?
Anyhow, I'm glad its working for you.

As for the attachment, it has to be a full path to a file: .mdb, .xls, etc. So if you want to attach a report, I think you need to export it to a fresh .mdb first and attach that. I've always used the email function as a notice, like "something is done" or "reminder" set on an event or scheduled task.

"strAttach" has to have a value like "\\servername\filename.mdb" or "C:\localdrive\finename.doc".

Please see below for your points.

To resolve the problem from a client side approach, they must have the following registry key added whcih will suppress Outlook from prompting them…

HKCU\software\policies\microsoft\policies\security…  DWORD=checkadminsettings value must be 1
keyboardsAuthor Commented:
To Team929 - I'm here, you did know I accepted your answer back in Nov'03, right?  Great info from everyone, and always like to know multiple ways to go about something.  Thanks again! :0}
I have set up a field as e-mail in access and made it a hyperlink when I try to send e-mail in a form using this I get the message cannot find proxy server can u explain how I can snd e-mail by clicking on the address I am making a front end using sql and vba for access, I am an amatuer!! at using access
keyboardsAuthor Commented:
Do you mean you have a hyperlink datatype for a field in a table in access?  If so, you have to specify the address in the form of "" to get it to bring up your default email browser/editor, if you have one set up.  Lemme know how it goes.  Email addy is
I looked for HKCU\software\policies\microsoft\policies\security…  on my computer so I could change the DWORD=checkadminsettings value to 1 and I can't find it.  What needs to be set up on my computer to have this setting in my registry?  Am I missing something I need for this?  I get that same "The computer is sending email on your behalf" box and I'd love to be able to make a simple change in the registry to solve the problem if that doesn't create other problems for me.


I'm currently adding the accepted answer to my application but have no idea what the objEmail should be declared as.  is it an outlook.application or an outlook.mailitem?
Could someone help?? cheers. Philbee
keyboardsAuthor Commented:

Make sure you include the "Microsoft CDO 1.21 Library" by checking it in the VB editor...Tools...References


    Dim objEmail As New CDO.Message

Hope this helps.

keyboardsAuthor Commented:
FPJB - if it doesn't exist, you must create it, all levels, in the registry

cheers for the comment keyboards.  Am working it now. If I'm successful I will have to get some points to you somehow.  

I included the "Microsoft CDO 1.21 Library" and the "Microsoft CDO For Exchange 2000 Library", but I am still receiving an error on the 'objEmail.Send' line.

The error states "The transport failed to connect to the server."

What am I missing here?


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.