Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Sending email from ms Access using CDO , Problem ?

Sending email from ms Access using CDO , Problem ?

Scheduled Pinned Locked Moved Database
helpdatabasecomquestionannouncement
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dcode25
    wrote on last edited by
    #1

    Hello ! i'm developping an ms-access database , and i need to send emails with attachment.i use CDO to send emails. this is my code : ------------------------------------------------- Dim cdoConfig As Object Dim msgOne As Object With cdoConfig.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.yahoo.com" .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myusername" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword" .Update End With Set msgOne = CreateObject("CDO.Message") Set msgOne.Configuration = cdoConfig msgOne.To = "adress@hotmail.com" msgOne.From = "myusername@yahoo.com" msgOne.Subject = "test" msgOne.TextBody = "this is a test" msgOne.AddAttachment "c:\test.txt" msgOne.Send ------------------------------------------------- The code is working but only sometimes.So i send email , no error is displaying , but the email is not received , or in rare cases the email arrive after 3-4 hours or more.but in 30 emails sended only 1 or 2 arrives. Is very strange because i don't get any error message. Can you help me ! Thank you in advance.

    B J 2 Replies Last reply
    0
    • D dcode25

      Hello ! i'm developping an ms-access database , and i need to send emails with attachment.i use CDO to send emails. this is my code : ------------------------------------------------- Dim cdoConfig As Object Dim msgOne As Object With cdoConfig.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.yahoo.com" .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myusername" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword" .Update End With Set msgOne = CreateObject("CDO.Message") Set msgOne.Configuration = cdoConfig msgOne.To = "adress@hotmail.com" msgOne.From = "myusername@yahoo.com" msgOne.Subject = "test" msgOne.TextBody = "this is a test" msgOne.AddAttachment "c:\test.txt" msgOne.Send ------------------------------------------------- The code is working but only sometimes.So i send email , no error is displaying , but the email is not received , or in rare cases the email arrive after 3-4 hours or more.but in 30 emails sended only 1 or 2 arrives. Is very strange because i don't get any error message. Can you help me ! Thank you in advance.

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Maybe Yahoo mail can be slow! Try to use gmail smtp and see if same happens with gmail too. Pershendetje!


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

      D 1 Reply Last reply
      0
      • B Blue_Boy

        Maybe Yahoo mail can be slow! Try to use gmail smtp and see if same happens with gmail too. Pershendetje!


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

        D Offline
        D Offline
        dcode25
        wrote on last edited by
        #3

        Hello ! Thank you for your response. Is the same thing with gmail, hotmail , yahoo and with other domains.The emails are too slow ore never received.Another thing that i notice today is that mos of CDO emails that are received , are marked as spams.When i send emails with the same accounts but not with CDO everything is OK. What can i do ? Thank you.

        1 Reply Last reply
        0
        • D dcode25

          Hello ! i'm developping an ms-access database , and i need to send emails with attachment.i use CDO to send emails. this is my code : ------------------------------------------------- Dim cdoConfig As Object Dim msgOne As Object With cdoConfig.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.yahoo.com" .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myusername" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword" .Update End With Set msgOne = CreateObject("CDO.Message") Set msgOne.Configuration = cdoConfig msgOne.To = "adress@hotmail.com" msgOne.From = "myusername@yahoo.com" msgOne.Subject = "test" msgOne.TextBody = "this is a test" msgOne.AddAttachment "c:\test.txt" msgOne.Send ------------------------------------------------- The code is working but only sometimes.So i send email , no error is displaying , but the email is not received , or in rare cases the email arrive after 3-4 hours or more.but in 30 emails sended only 1 or 2 arrives. Is very strange because i don't get any error message. Can you help me ! Thank you in advance.

          J Offline
          J Offline
          jchalfant
          wrote on last edited by
          #4

          Mail sent using CDO is sent from the machine you're running it from. I believe there's a way to send the mail via a mail server by using server (I could be wrong); however, due to security concerns this isn't often done. Most firewall and anti-virus applications will also catch this sort of thing unless it's configured to allow mail to be sent out. I would recommend interop with outlook, since the libraries for this are available when outlook is installed. http://support.microsoft.com/kb/310263[^] Working in an exchange environment, I wound up using MAPI for one of my solutions. A quick search on CP for "MAPI" will yield several options for you.

          D 1 Reply Last reply
          0
          • J jchalfant

            Mail sent using CDO is sent from the machine you're running it from. I believe there's a way to send the mail via a mail server by using server (I could be wrong); however, due to security concerns this isn't often done. Most firewall and anti-virus applications will also catch this sort of thing unless it's configured to allow mail to be sent out. I would recommend interop with outlook, since the libraries for this are available when outlook is installed. http://support.microsoft.com/kb/310263[^] Working in an exchange environment, I wound up using MAPI for one of my solutions. A quick search on CP for "MAPI" will yield several options for you.

            D Offline
            D Offline
            dcode25
            wrote on last edited by
            #5

            Thank you ! But i want to send email from inside my application without open outlook window.I have all the information like SMTP server , username , password , smtp port ...etc.so what's wrong with CDO ?Is CDO usable or not ?

            J 1 Reply Last reply
            0
            • D dcode25

              Thank you ! But i want to send email from inside my application without open outlook window.I have all the information like SMTP server , username , password , smtp port ...etc.so what's wrong with CDO ?Is CDO usable or not ?

              J Offline
              J Offline
              jchalfant
              wrote on last edited by
              #6

              CDO will work if you're only ever sending to a single address and you have your anti-virus/firewall configured to allow emails to be sent out originating from your computer; and if you allow spam from your origin address on the destination account. If you're looking to email end users with a non-static address, I recommend looking into other solutions.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups