• Send e-mail without security alert? (Access 2003/O

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Send e-mail without security alert? (Access 2003/O

    Author
    Topic
    #434176

    From Access VBA, is there a way to send e-mail using Outlook that doesn’t throw those prompts about “An application is attempting to use Outlook”? I believe this was a security patch some time ago. I’ve been tasked with assisting some users with former employee’s Access databases. Without lots of rewriting or switching to jmail, it like to get around this issue.

    Viewing 1 reply thread
    Author
    Replies
    • #1022992

      See post 317048 for some ways to suppress the warning “A program is attempting to …”. The free utility ClickYes is the simplest to use.

      • #1022995

        Thanks for the links. dizzy nuts Wow, this is crazy. The duct tape we need to use to get this to work.

    • #1023028

      You could send an email through the smtp and bypass outlook completely…

      Sub SendSMTPMail()
        '// Send SMTP Mail messsage
        Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing", _
                  cdoSendUsingPort = 2, _
                  cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
        Dim iMsg, iConf, Flds
        Dim sMsg As String, sRetAddress As String
        sRetAddress = "me@home.com"
        
        '// Create the CDO connections.
        Set iMsg = CreateObject("CDO.Message")
        Set iConf = CreateObject("CDO.Configuration")
        Set Flds = iConf.Fields
           
        '// SMTP server configuration.
        With Flds
          .Item(cdoSendUsingMethod) = cdoSendUsingPort
          .Item(cdoSMTPServer) = "SMTPServerName"  ' ""
          .Update
        End With
      
        '// Set the message properties and send
        With iMsg
          Set .Configuration = iConf
          .To = "you@home.com"
          .CC = sRetAddress
          .FROM = sRetAddress
          .Subject = "Request to obtain quote"
          .TextBody = "Can you please seek a quote for the following item." & _
                    vbCr & vbCr & sMsg
          '.AddAttachment Attachment    '// An attachment can be included if wanted
          .Send                         ' send the message.
        End With
      End Sub
      • #1023078

        Thanks for the code. Does it require IIS(with CDONTS) running on the machine the code is on to work?

        • #1023219

          I don’t believe so (but you are getting into a grey area for me). It certainly works for us on our standard desktop setup without anything special (and through Citrix) and I would be surprised if IIS was ever installed on our standard-build PCs.

          This link states that ‘CDONTS installs with various Microsoft software products, and you can find it on most systems’

      • #1034139

        I’ve just started to use CDO to send a group of emails from Access. I get a compile error on my CreateObject line. I added the reference Microsoft CDO for Windows 2000 Library. Is there some other reference that needs to be added? i didn’t see any other CDO related ones.

        The compile error I get is “Object required”. My line looks like this:
        Set objMessage = CreateObject(“CDO.Message”)

        I’ve tried dimensioning objMessage as string. There really is no other type that shows up that looks like it would apply.
        Also, I’ve seen references in posts to CDOnuts (??) or something like that. Is that different?

        Any ideas? Thanks.

        • #1034144

          I figured out how to declare this and it works now.

          Dim objMessage as CDO.Message
          Then when I do the set I don’t get an error, and the emailing is working fine.

          thanks.

          • #1034213

            I’m glad to hear you’ve got it working now. Sorry that the variable naming was misleading in that post where I put the code – now that I look at it, iMsg is certainly not an integer.

    Viewing 1 reply thread
    Reply To: Send e-mail without security alert? (Access 2003/O

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: