CDO email fails after 6 successful sent emails

Bob Vitter 181 Reputation points
2021-11-30T19:28:47.997+00:00

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("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'Server port (typically 25, 465, 587) 'The next line is commented out because of the use of SSL encryption
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 'Commonly -> 465 SSL, 587 TLS
'SMTP server IP or Name
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.X.org"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
'SMTP Account User ID
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "itteam@X.org"
'SMTP Account Password
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "X"
'Number of seconds to wait for a response from the server before aborting
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
'Use SSL for the connection (False or True) -> If using SSL, do not specify the Port above
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True '!!!!Always use some form of encryption!!!!
'Use TLS for the connection (False or True)
.Item("http://schemas.microsoft.com/cdo/configuration/sendtls") = True 'Optional, but recommended if available
.Item("http://schemas.microsoft.com/cdo/configuration/BodyFormat") = 2
.Update
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
    2021-12-01T07:57:37.287+00:00

    It sounds like your secret smtp service, mail.x.org, 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