CDO email fails after 6 successful sent emails

Bob Vitter 181 Reputation points

I get the error message -2147220973 The transport failed to connect to the server. on the 7th email - every time

Application is looping through a selected set of records to format and send an email message

If I restart with a new set of records it will again stop after 6 successful emails

This is the coding in the Send_Email subroutine called

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Dim objCDOMsg As Object
Dim Index As Long

Set objCDOMsg = CreateObject("CDO.Message")

'CDO Configuration
With objCDOMsg.Configuration.Fields
.Item("") = cdoSendUsingPort
'Server port (typically 25, 465, 587) 'The next line is commented out because of the use of SSL encryption
'.Item("") = 465 'Commonly -> 465 SSL, 587 TLS
'SMTP server IP or Name
.Item("") = ""
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
.Item("") = cdoBasic
'SMTP Account User ID
.Item("") = ""
'SMTP Account Password
.Item("") = "X"
'Number of seconds to wait for a response from the server before aborting
.Item("") = 10
'Use SSL for the connection (False or True) -> If using SSL, do not specify the Port above
.Item("") = True '!!!!Always use some form of encryption!!!!
'Use TLS for the connection (False or True)
.Item("") = True 'Optional, but recommended if available
.Item("") = 2
End With

'CDO Message
objCDOMsg.Subject = Subject_Line
objCDOMsg.From = "admin@X"
objCDOMsg.To = Send_To

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
797 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gustav 712 Reputation points MVP

    It sounds like your secret smtp service,, has applied a limit to how many mails to send per minute, hour, or something.
    This is common, to limit spam. Usually, one can get an agreement to have that limit raised or removed.

    0 comments No comments

0 additional answers

Sort by: Most helpful