I have this newsletter code, that takes emails from the recordset Tonews and sends a specific message + attach

dim cdoConfig
Set cdoConfig = CreateObject("CDO.Configuration") 
With cdoConfig.Fields  
        .Item(cdosmtpserverport) = 26
        .Item(cdoSendUsingMethod) = 2
        .Item(cdoSMTPServer) = smtpserver
        .Item(cdoSMTPAuthenticate) = 1  
        .Item(cdoSendUsername) = musername
        .Item(cdoSendPassword) = mpassword
    End With 
dim cdoMessage			

do while not Tonews.eof
    Set cdoMessage = CreateObject("CDO.Message")  
    With cdoMessage 
        Set .Configuration = cdoConfig 
        .From =  "raport@iisconsult.ro"
		.To = Tonews("email")
		.Subject = Session("title")		
        .HTMLBody = msg
         if  Session("attach") <> "" then 
  		.AddAttachment  "D:\Inetpub\wwwroot\iis2\upload" &  Session("attach") 
 end if
     End With  
   Set cdoMessage = Nothing  

    Set cdoConfig = Nothing

Everything works fine, except that the email is transmitted twice to each receipient.

So I would like to help modify my code so that:
1. send message only once
2. split the recordset considering the following mail server restrictions:
- A mail box can't send more that 50 emails within 10 minutes.
- A mail box can' send an email to more that 30 recipients in each sending process.
- if are more than 1000 messages sent to swith to another account.

Thank you.

6 Years
Discussion Span
Last Post by ArtistScope

First check that that your mail server doesn't send everyone 2 emails anyway. I have a few clients that when they send an email, their server or mail program sends 2 of the same mail... every time.

So make sure that is not happening first.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.