Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 19812
  • Last Modified:

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?
0
keyboards
Asked:
keyboards
  • 4
  • 4
  • 3
  • +7
1 Solution
 
DexstarCommented:
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
 
Team929Commented:
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
 
svenkarlsenCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
OracleSWNCommented:
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
 
svenkarlsenCommented:
0
 
Team929Commented:
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
 
OracleSWNCommented:
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
 
OracleSWNCommented:
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
 
Team929Commented:
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
 
OracleSWNCommented:
Team929,

Please see below for your points.

http://www.experts-exchange.com/Databases/MS_Access/Q_20796527.html
0
 
the_rosterCommented:
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
 
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}
0
 
kevinoakesCommented:
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
 
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 "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
 
FPJCBCommented:
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
 
PhilbeeCommented:
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
 
keyboardsAuthor Commented:
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
 
keyboardsAuthor Commented:
FPJB - if it doesn't exist, you must create it, all levels, in the registry

keyboards
0
 
PhilbeeCommented:
cheers for the comment keyboards.  Am working it now. If I'm successful I will have to get some points to you somehow.  
0
 
DrumsticksCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
  • 3
  • +7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now