[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is it Possiable to speed up CDO.Message.

Posted on 2004-11-03
4
Medium Priority
?
776 Views
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
                Else
                    Me.lblEmailTotal.Text = rsEmailCount("EmailCount").Value
                    Dim n As Integer
                    Dim m As Integer
                    n = 0
                    m = 0

                    ' Finish building email and sending
                    Do
                        Dim strName As String
                        If Not IsDBNull(rsEmailList("fldFirstName").Value) Then
                            strName = rsEmailList("fldFirstName").Value
                        Else
                            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

                        Try
                            mailServer.Send(newMail)
                        Catch c As Exception
                            MessageBox.Show(c.InnerException.InnerException.ToString())
                        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))
                        cmdUpdateEmail.Execute()
                        ' updating form's email counter.
                        Me.lblEmailNeed.Text = Me.lblEmailTotal.Text - n
                        Me.lblCount.Text = n
                        rsEmailList.MoveNext()
                    Loop Until rsEmailList.EOF



--------------------------------------------------------------------------------------
0
Comment
Question by:Richard Comito
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Glom
ID: 12491076
Hi,
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.

Bye
0
 

Author Comment

by:Richard Comito
ID: 12499346
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?
0
 
LVL 4

Accepted Solution

by:
Glom earned 1000 total points
ID: 12502077
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.
0
 

Author Comment

by:Richard Comito
ID: 12505077
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.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

829 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