Solved

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

Posted on 2001-08-11
9
340 Views
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
0
Comment
Question by:rsaji
[X]
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
9 Comments
 
LVL 18

Expert Comment

by:mgfranz
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
objCDOMail.Send
Set objCDOMail = Nothing
' Now write out who received the message.
Response.Write "Message sent to " & strTo & "!<br>"

   Next
%>
0
 
LVL 1

Author Comment

by:rsaji
ID: 6375920
mgfranz,
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.
0
 
LVL 18

Expert Comment

by:mgfranz
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:rsaji
ID: 6377307
mgfranz,
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
               objRs.MoveFirst
               while objRs.EOF = false
                    if instr(1, objRs.Fields(0).Value, "@") > 0 then
                         if RecepList = "" then
                              RecepList = RecepList & objRs.Fields(0).Value
                         else
                              RecepList = RecepList & ";" & objRs.Fields(0).Value
                         end if
                    end if
                    objRs.MoveNext
               wend
               objRs.Close
               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 & ">"
          else
               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
          else
               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.MailFormat=0    
          objMail.Body = strBody                                        
          objMail.Send                                                            'and send the message
          Set objMail = Nothing                                                  'then destroy the component
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 100 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?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6377609
Check out your this opened question. Try to do something to it.
http://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=11980878

hongjun
0
 
LVL 2

Expert Comment

by:MCM
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.
0
 
LVL 7

Expert Comment

by:John844
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)
0
 
LVL 18

Expert Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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