Results 1 to 10 of 10
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    Hitting some sort of bulk limit with CDO?


    In executing a CDO mailing function in my app, I hit the -2147220975 error condition after having successfully sent out 81 emails. With a data-point setting, I resumed the function continuing at the point of the first failure only to hit the same error after 83 emails. I know of no limits with CDO. The body of the emails are just a couple of lines plus a URL, so size ought not be the issue. There are no attachments. The app uses the Google Gmail "App Password" as authority to use the IMAP.Gmail.Com server.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Don't email servers often have user account based limits to stop runaway emailing (especially when generated via code)? I'd check with the server admin.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    I saw CDO and my eyes glazed - didn't see it was GMail so forget the admin idea.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    I notice that the failing client uses the "App Password" along with the server Imap.Gmail.com, while all my development testing relied on SMTP.GoogleMail.com. Google documents the difference:

    1. What's the difference between IMAP and SMTP? The short answer is that IMAP connects to your email providers' server and is used for receiving email while SMTP is used for sending mail to other servers.


    2. IMAP is used to retrieve messages, and SMTP is for sending data. IMAP works between the server and client for communication, and SMTP works between servers to transfer information. IMAP allows users to organize emails onto the server, while SMTP allows organizing emails on client storage.

    As soon as I have access to the client machine, I'll change the authorization properties to use SMTP.GoogleMail.com and resume at one record past the failure. I think there's a total of 315 records in the queue. (164 already sent successfully)


    EDIT: App resumed and sent out another 89 emails using SMTP.GoogleMail.com server before again failing with same error. Welshgasman's reference suggests there's a 500 per day limit for personal email accounts. Since the current OP is dealing with a recordset containing only 315 records, I wouldn't expect any issues as compared with the 500 limit. I remain in mystery with OP unresolved.
    Last edited by GraeagleBill; 02-03-2023 at 06:55 PM.

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Can you please show us the description for the
    -2147220975 error condition
    ? And the code you're using would be helpful, as there might be some other causes to this error?

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Another item of interest, at least from my point-of-view, is that last week this same app sent out 137 emails with double attachments without any issues whatsoever. EDIT: 2/4 Could this issue be related to the version of Windows? The 137 emails noted were sent from a Windows 11 system, whereas the issue sited in the OP occurred on a clients Window 10 system. My understanding is the CDO is an API to the Windows MAPI, putting the issue partially in the system realm?

    The snippet of code that initiates the "send":
    Code:
        DoCmd.Hourglass True
        
        With rsNewsLtr
        If .RecordCount > 0 Then
            .MoveFirst
                While Not .EOF
                strRecipient = ![e-MailAddr]
                strFName = !FirstName
                strLName = !LastName
                If bolBdyTxtOnly <> True Then
                    If bolCont = True Then Call SendUsingCDOMail(strSubj, strRecipient, "Dummy", Replace(strMsgBody, "NnNnNnNn", strFName))
                End If
                intNLCount = intNLCount + 1
                .MoveNext
                Wend
        End If
        
        End With
        
        DoCmd.Hourglass False
    Screenshot of the error:
    Click image for larger version. 

Name:	000.jpg 
Views:	27 
Size:	28.2 KB 
ID:	49635

    The CDO module I use: (Mixture of my code mixed with Paul's)
    Code:
    Public Sub SendUsingCDOMail(strSubj, strToEMA, strAttName, strBody)
    '*=*=*=*=*=(12/27/2022 Code courtesy of Paul Baldarelli)=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    '  E.g., SendMail("TMS Offerings for 2022", "wcsreno@gmail.com", strStmtPDFName, strBody)
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
        Dim mail    As CDO.message
        Dim config  As CDO.Configuration
        Dim strAuthSender As String
        Dim strReplyTo As String
        Dim strAttmts() As String
        Dim I As Integer
        
        Set mail = CreateObject("CDO.Message")
        Set config = CreateObject("CDO.Configuration")
        
        config.Fields(cdoSendUsingMethod).Value = cdoSendUsingPort
        config.Fields(cdoSMTPServer).Value = Nz(DLookup("CDOSMTP", "InstProperties"))
        config.Fields(cdoSMTPAuthenticate).Value = 1
        strReplyTo = Nz(DLookup("CDOReplyTo", "InstProperties"))
        strAuthSender = Nz(DLookup("CDOEMA", "InstProperties"))
        config.Fields(cdoSendUserName).Value = strAuthSender
        config.Fields(cdoSendPassword).Value = GetAppPW(Nz(DLookup("CDOPW", "InstProperties")))
        config.Fields(cdoSMTPServerPort).Value = 465
        config.Fields(cdoSMTPUseSSL).Value = True
        config.Fields.Update
        
        Set mail.Configuration = config
    
    
        With mail
            .To = strToEMA
            .From = strAuthSender
            .ReplyTo = strReplyTo
            .Subject = strSubj
            .TextBody = strBody
            If (strAttName <> "Dummy") And (Not IsNull(strAttName)) Then
                strAttmts = Split(strAttName, ";")
                For I = 0 To UBound(strAttmts)
                    If Len(Dir(strAttmts(I))) > 0 Then
                        .AddAttachment strAttmts(I)
                    Else
                        MsgBox "Specified attachment " & strAttmts(I) & " not found."
                        Exit Sub
                    End If
                Next I
            End If
            .send
        End With
        
        Set config = Nothing
        Set mail = Nothing
        
    End Sub
    Last edited by GraeagleBill; 02-04-2023 at 04:32 PM.

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    I've used CDO email for years without ever having issues of this kind.
    When i was still teaching, CDO was used to send bulk emails, sometimes to all staff which in a large school could easily exceed 300.
    That always worked fine though of course it was normally within an organisation.

    As for bulk email to external addresses, I've always used a multimailer app such as Mailchimp or SamLogic Multimailer.
    These process emails in batches to prevent any limitations on numbers imposed to restrict spammers.

    When trying to do bulk email yourself, you may well find the limit varies depending on the server, time of day etc, etc...
    In other words, you can't predict when the process will crash. So limit the number you send at once or use a bulk email app as above
    I very much doubt the use of CDO is in any way relevant to the issue

    However the error message above is explained in the documentation accompanying my example app which I believe you have a copy of.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #9
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks Colin. I will pursue the idea of using a bulk mailer as you suggest. I too did not believe that CDO had much to do if anything with the issue sited in the OP.
    Thanks again,
    Bill

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    For info, this message is from the help file accompanying my CDO app

    Click image for larger version. 

Name:	Capture.PNG 
Views:	15 
Size:	47.7 KB 
ID:	49811
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-03-2018, 11:12 PM
  2. Hitting Cancel and Stopping a Macro
    By oleander in forum Macros
    Replies: 7
    Last Post: 12-13-2017, 09:45 PM
  3. Replies: 20
    Last Post: 06-26-2014, 02:47 PM
  4. Replies: 1
    Last Post: 08-19-2013, 09:29 AM
  5. Replies: 1
    Last Post: 02-01-2010, 05:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums