?
Solved

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

Posted on 2003-11-12
20
Medium Priority
?
19,793 Views
Last Modified: 2008-11-27
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?
0
Comment
Question by:keyboards
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +7
20 Comments
 
LVL 19

Expert Comment

by:Dexstar
ID: 9736296
keyboards:

> 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:
http://www.experts-exchange.com/Applications/Email/Q_20695108.html

Hope that helps,
Dex*
0
 
LVL 2

Accepted Solution

by:
Team929 earned 1000 total points
ID: 9736461
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 = "myEmail@emailadd.com"
      objEmail.To = strTO '//// format "abc@emailadd.com; edf@emailadd.com"
      objEmail.BCC = strBCC
      objEmail.Subject = strSubject
      objEmail.TextBody = strMessage
      objEmail.AddAttachment strAttach
      objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtpservername.com"
      objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      objEmail.Configuration.Fields.Update
      objEmail.Send
      Set objEmail = Nothing

End Function
0
 
LVL 9

Expert Comment

by:svenkarlsen
ID: 9736981
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 = "mail.somecom.com"
    skMailAccount = "xx"

' Contents for the message
    skFromName = "Full Name"
    skFromAddr = "xx@somecom.com"
    skToName = "Full Name"
    skToAddr = "yy@someothercom.com"
    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
    Flds.Update

' 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) = ""
       .Fields.Update
       .Send
    End With

' Finished
    Set iMsg = Nothing
    Set iConf = Nothing

End Function



Kind regards,
Sven
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 1

Expert Comment

by:OracleSWN
ID: 9736992
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
0
 
LVL 9

Expert Comment

by:svenkarlsen
ID: 9737000
0
 
LVL 2

Expert Comment

by:Team929
ID: 9737070
OracleSWN,

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(...) = "smtpservername.com"
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.

0
 
LVL 1

Expert Comment

by:OracleSWN
ID: 9737477
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
0
 
LVL 1

Expert Comment

by:OracleSWN
ID: 9737534
Team929,

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.
0
 
LVL 2

Expert Comment

by:Team929
ID: 9737642
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".
0
 
LVL 1

Expert Comment

by:OracleSWN
ID: 9737723
Team929,

Please see below for your points.

http://www.experts-exchange.com/Databases/MS_Access/Q_20796527.html
0
 

Expert Comment

by:the_roster
ID: 10201665
CLIENT SIDE SOLUTION :)

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
0
 

Author Comment

by:keyboards
ID: 10202211
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}
0
 

Expert Comment

by:kevinoakes
ID: 10756304
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
0
 

Author Comment

by:keyboards
ID: 10759502
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 "mailto:email@domain.com" 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 keyboards@yahoo.com
0
 

Expert Comment

by:FPJCB
ID: 12124855
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.

  Thanks,

    Jeff
0
 

Expert Comment

by:Philbee
ID: 12627286
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
0
 

Author Comment

by:keyboards
ID: 12629658
Philbee,

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

Then...

    Dim objEmail As New CDO.Message

Hope this helps.

keyboards
0
 

Author Comment

by:keyboards
ID: 12629783
FPJB - if it doesn't exist, you must create it, all levels, in the registry

keyboards
0
 

Expert Comment

by:Philbee
ID: 12643455
cheers for the comment keyboards.  Am working it now. If I'm successful I will have to get some points to you somehow.  
0
 
LVL 1

Expert Comment

by:Drumsticks
ID: 12960434
Hello,

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?

Regards,
Drumsticks

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question