Is it Possiable to speed up CDO.Message.

Posted on 2004-11-03
Last Modified: 2008-01-09
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

Question by:GabicusC
    LVL 4

    Expert Comment

    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.


    Author Comment

    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?
    LVL 4

    Accepted Solution

    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.

    Author Comment

    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.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now