SMTP slower for bulk mailing. How to use Exchange server instead using ASP ?

Posted on 2001-08-11
Medium Priority
Last Modified: 2008-02-01
I have an application which is written in ASP which runs on IIS 4 using CDONTS and SMTP server. The problem with this is it is taking a long time to send mails if I want to send the mail to a larger group of recipients. It potentially freezes my server for long time. Looks like the implementation of SMTP is such a way that it will take the message and try to send to each recipient seperately. I heard that Exchange server is the best option in such situation. I have an exchange server running on the same network. Can I use that for sending mails with out using SMTP. Is it just a configuration change or do I need to recode the page to use exchange server. Any one has this kind of experience ? Your help will be highly appreciated
Question by:rsaji
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 6375789
SMTP is the protocol most email servers use to process email, X400, POP3 are others.  Exchange and CDO use SMTP to process email messages.

If you are having problems processing emails, it might just be a problme with the script.

Post your code, but this is what I use to send bulk email.  The address's are stored in a .txt file with other info, I strip out the junk to get just the address then just run a loop on the resulting "match".  To process and send about 500 emails takes only about 5 seconds with CDONTS on my 2000 laptop;

Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("c:\inetpub\wwwroot\xyz.txt",1, true)
     strPhrase = ts.ReadAll
Dim objRegEx, Match, Matches, StrReturnStr
Set objRegEx = New RegExp
objRegEx.Global = True
objRegEx.IgnoreCase = True
objRegEx.Pattern = "~[^/]*"
Set Matches = objRegEx.Execute(strPhrase)

For Each Match in Matches

     theStr = Match.value
     theStr = Replace(theStr, "~", "")
          strTo = theStr&"@pe.net"
          strSubject = "Updates"
          strBody = "This message is being sent as a courtesy to all subscribers.  "
     strBody = strBody & vbCrLf  
     strBody = strBody & "I may not be getting to every subscriber, if you know someone who is on the xyz.Net system, please inform them of this issue."

Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = "Mark G. Franz <mgfranz@pe.net>"
     objCDOMail.To = strTo
     objCDOMail.Subject = strSubject
     objCDOMail.Body = strBody
Set objCDOMail = Nothing
' Now write out who received the message.
Response.Write "Message sent to " & strTo & "!<br>"


Author Comment

ID: 6375920
I am using the same code to send tha mail. But the difference is I will be sending the mail to 8000 recipients, all in different mail servers(ie x@hotmail.com, y@yahoo.com, z@usa.net etc). In your case you are sending the mail to the a set of recipients in the same server, that is why it may be faster. In this case case we are using the SMTP server. The alternative I am looking for is the Exchange server one with out using the SMTP server. The protocol internally used by Exchange server may be SMTP.
LVL 18

Expert Comment

ID: 6375932
It's irrelevant that the recipients are on the same domain, remember, once the message has been processed and sent out on the internet cloud, SMTP and CDO don't care where it goes.  Once the message is processed, my script sends the next one.

I think you may have something else going on... Post your code.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 6377307
Here is my code. I am using html format for the mail body

          RecepList = ""
          SQL = "select emailaddress from users"
          set objRs = Server.CreateObject("ADODB.Recordset")
          objRs.CursorType = 3
          objRs.Open SQL, objConn, , , 1
          if objRs.eof = false then
               while objRs.EOF = false
                    if instr(1, objRs.Fields(0).Value, "@") > 0 then
                         if RecepList = "" then
                              RecepList = RecepList & objRs.Fields(0).Value
                              RecepList = RecepList & ";" & objRs.Fields(0).Value
                         end if
                    end if
               set objRs = nothing
          end if

          strBody = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
          strBody = strBody & "<html>"
          strBody = strBody & "<head>"
          strBody = strBody & "<title>" & Request.Form("txtSubject").item & "</title>"
          strBody = strBody & "</head>"
          strBody = strBody & "<body bgcolor=""FFFFFF"">"
          if Request.Form("txtFontSize").Item  = "" then
               strBody = strBody & "<p><font size =""2"" face=" & Request.Form("cboFontType").Item & ">"
               strBody = strBody & "<p><font size =" & Request.Form("txtFontSize").Item & " face=" & Request.Form("cboFontType").Item & ">"
          end if
          strBody = strBody & Replace(Request.Form("txtText").Item, chr(10), "<BR>")
          if Request.Form("txtLink").Item <> "" then
               strBody = strBody & "<BR><BR>" & "For more information click on the following link"  
               strBody = strBody & "<BR>" &  "<a href=" & Request.Form("txtLink").Item & ">" & Request.Form("txtLink").Item & "</a>"
          end if
          strBody = strBody & "<BR><BR><BR><I>Disclaimer:<BR><BR>"
          strBody = strBody & Request.Form("txtDisclaimer").Item
          strBody = strBody & "<BR><HR>" & Request.Form("txtCopyright").Item  & "</I>"
          strBody = strBody & "</body>"
          strBody = strBody & "</html>"
          Set objMail = Server.CreateObject("CDONTS.NewMail")
          objMail.To = "User"
          objMail.Bcc = RecepList                                   'set 'To' address
          if Request.Form("txtReturn").Item <> "" then
               objMail.From = Request.Form("txtReturn").Item                    'set 'From' address
               objMail.Value("Reply-To") = Request.Form("txtReturn").Item 'set'Reply to' address
               objMail.From = "Unknown"
               objMail.Value("Reply-To") = "Unknown"
          end if
          objMail.Subject = Request.Form("txtSubject").item     'set the subject line
          objMail.BodyFormat=0 'for html data
          objMail.Body = strBody                                        
          objMail.Send                                                            'and send the message
          Set objMail = Nothing                                                  'then destroy the component
LVL 18

Accepted Solution

mgfranz earned 300 total points
ID: 6377505
Oh I see... you are creating a single message with BCC: as the recipient list.  It has been my experience that this is going to be much slower than sending messages on a loop, let's think about this for a second.  In BCC: mail, I need to first create a list of names, then send a message to each recipient at a single time.  If I loop through the names, and send a message to each recipient, I don't create an array list, and I don't send a bulk email, but individual messages.

Trust me, it is faster to send 1 messages to 1 recipient 1000 times than to send 1 message to 1000 recipients 1 times.  The message has to go through the entire list of names and send the message over and over again, with a simple loop, the message gets sent once, then again...  follow?
LVL 33

Expert Comment

ID: 6377609
Check out your this opened question. Try to do something to it.


Expert Comment

ID: 6378504
Under properties for SMTP server is IIS console, go to delivery/advanced/smart host. I've never done it, but I beleive ou can specify the address of your exchange server as the smart host. SMTP virutal server will then send the exchange server all of your messages, and let exchange server sort out the delivery. I don't know how SMTP & Exchange shake hands, perhaps someone else will be able to fill in the authentication details. But i think this is the general procedure.

The name JMail gets bandied about a lot as an alternative to CDONTS, but I know nothing about whether you can instruct it to hand off responsibility for message delivery to Exchange. But again, some else may be able to supply some more information.

Expert Comment

ID: 6380018
part of your bottle neck might be 8000 string concatanations.  str = str & "something else"

when you are working with string concatanation, the larger the string gets, the slower it gets.  You might try commenting out the portion that sends the email to verify where your bottleneck is.

You might also try sending the email message out for every 50 entries. (if bottleneck is in string concatanation)
LVL 18

Expert Comment

ID: 6380343
JMail uses either a local or remote SMTP server, so it really isn't a solution...

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

718 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