Is it Possiable to speed up CDO.Message.

I have the following code that sends out about 22,000 Emails.  However it send the emails at about 1 every 5 sec or so.  If I turn on my Norton it will go faster but then I use up 100% of my processor sending them out.  Is there a way to speed this up or is the slow down in my code.  The Email that is generated is about 200KB.  I pull all the information from the Database and build most of the email in a separate class then I add it to a string.  I then concatenate the string and add in small amount of changes to the Salutation and Unsubscribe button.

Any advice would be helpful.


                Dim objEmailHeader As wklyEmail = New wklyEmail
                Dim strEmailHeader As String = objEmailHeader.emailHeader
                Dim strEmailSubscribe As String = objEmailHeader.emailSubscribe
                Dim strEmailFooter As String = objEmailHeader.emailFooter
                Dim strEmailBody As String = objEmailHeader.emailBody
                Dim strEmailBody1 As String = objEmailHeader.emailBody1
                Dim strEmailBody2 As String = objEmailHeader.emailBody2
                Dim strEmailBody3 As String = objEmailHeader.emailBody3
                Dim rsEmailList As ADODB.Recordset = objEmailHeader.rsEmailList
                Dim rsEmailCount As ADODB.Recordset = objEmailHeader.emailCount
                Dim strTopEmail As String
                Dim strBottomEmail As String

                strTopEmail = strEmailHeader + strEmailBody1
                strBottomEmail = strEmailBody2 + strEmailBody3 + strEmailBody

                If rsEmailList.EOF Then
                    MsgBox("The Email List was Empty.")
                    GoTo lastline
                    Me.lblEmailTotal.Text = rsEmailCount("EmailCount").Value
                    Dim n As Integer
                    Dim m As Integer
                    n = 0
                    m = 0

                    ' Finish building email and sending
                        Dim strName As String
                        If Not IsDBNull(rsEmailList("fldFirstName").Value) Then
                            strName = rsEmailList("fldFirstName").Value
                            strName = "0"
                        End If
                        'adding name and id to Salutation and Unsubscribe.
                        Dim strEmailSalutation As String = objEmailHeader.emailSalutation(strName)
                        Dim strEmailUnsubScribe As String = objEmailHeader.emailUnsubscribe(rsEmailList("idEmailService").Value)

                        'add Email for the Wkly Email to the email object
                        newMail.Body = strTopEmail + strEmailHeader + strBottomEmail + strEmailUnsubScribe + strEmailFooter
                        n = n + 1
                        'Adding new EmailAddress to the email.
                        newMail.To = rsEmailList("fldEmailAddress").Value

                        Catch c As Exception
                        End Try

                        ' update Database the email has been sent
                        Dim cmdUpdateEmail As New ADODB.Command
                        cmdUpdateEmail.CommandText = "updateEmailService"
                        cmdUpdateEmail.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
                        cmdUpdateEmail.ActiveConnection = objConn
                        cmdUpdateEmail.Parameters.Append(cmdUpdateEmail.CreateParameter("@idEmailService", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput, 4, rsEmailList("idEmailService").Value))
                        ' updating form's email counter.
                        Me.lblEmailNeed.Text = Me.lblEmailTotal.Text - n
                        Me.lblCount.Text = n
                    Loop Until rsEmailList.EOF

Richard ComitoDirector of ITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried to put more than one recipient in the newMail.To property, seperated by commas ? That would make grouped sendings and improve the speed of your App.
Tip : If you don't want the recipient to see the other recipients, use newMail.Bcc instead of newMail.To.

Richard ComitoDirector of ITAuthor Commented:
Good suggestion, but I have each email personalized.  From what I am reading I need to use a third party dll.  If that is true then where would I find a third party dll?
Well I just saw that your email is about 200KB, the slow down could come directly from your internet connection.
If your Upload speed is 256, it will take almost 6 or 7 seconds. In that case this is absolutely necessary to wait the tranfer time.
I don't know what is inside the mail you create, but if there is attached files, I suggest you don't send it with the email but put a hyperlink to an internet address where you posted the file (for this purpose). That should speed up a lot.
I hope this can help you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard ComitoDirector of ITAuthor Commented:
No I am on a T-1 and with no attachments.   I send out pure html text.  What I am tring to figure out is how other Listserv programs can send out the same type of files and not have the same type of dealy.  I was reading on VBCity that  CDO.message is a wrapper for the old CDONTS and the Authanticating with the exchange server is where the slow down is coming from.  I have found a way to use Norton and have Norton scan the files before it is sent without showing me the progress.   With that work around I am no able to send about 1000 emails every 10 minutes and Norton is now only using 50% of my proccessor and not the full 100% as it was at first.  But I would think that if other programs can do this why can't I.

Glom, Thanks for your help and am looking forward to your comments.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.