#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    5
    Rep Power
    0

    Cool Problem sending CDONTS mail within loop


    I've got a sticky issue. Hope some one else out there has run into this and can help:

    I am trying to send e-mails to customers in a database. Each e-mail is customised for each customer, so I cannot simply copy all customers on the same e-mail. My logic loops through the appropriate recordset and attempts to send a notification e-mail to each customer. The problem is that about 10 - 20% of the e-mails do not get sent! (I know this because I :bcc myself on all the e-mails.) I also know that there is no problem with the e-mail addresses because when I try again to run the program with the same addresses but a smaller list of customers, those mails go out just fine.

    The program generates a report which shows that it tried to send all the appropriate e-mails, but in reality several of the mails were not sent. What's interesting is that all of the e-mails near the beginning of the program execution get sent. But as the program goes on, more and more get skipped. It seems that CDONTS cannot keep up with the program execution.

    Does anyone know of a way to solve this? What would be great would be a DO... WHILE loop that kept trying until the e-mail was sent successfully. But, for that approach to work, there would have to be some way for the program to check if the e-mail had gone out successfully. Another option would be a loop that waited until the *previous* e-mail had been sent successfully before attempting to send the next one.

    Does anyone know of a way to test either of those conditions or of an alternate approach to avoid this problem I am having?

    Thanks for any help

    - BBHoo92
  2. #2
  3. The Laughing Moderator
    ASP Scholar (3000 - 3499 posts)

    Join Date
    Apr 2004
    Location
    Sydney, Australia
    Posts
    3,268
    Rep Power
    41
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    5
    Rep Power
    0
    Thanks -- I appreciate the tip, but I'm too cheap to spend the $200. Also, it sounds like this isn't really an event-driven solution. It sounds like more of a simple time delay. I believe there must be a simple, free solution that I haven't found yet.


    BBHoo92
  6. #4
  7. Beyond The Impossible
    ASP Adventurer (500 - 999 posts)

    Join Date
    Sep 2003
    Location
    Shawnee Mission, KS, USA
    Posts
    921
    Rep Power
    13
    Well that one is free, only it $199.99 if you want the source code!
  8. #5
  9. The Laughing Moderator
    ASP Scholar (3000 - 3499 posts)

    Join Date
    Apr 2004
    Location
    Sydney, Australia
    Posts
    3,268
    Rep Power
    41
    You can write your own timer loop to run inside the mail loop, something like:

    Code:
     dim t, i 
    t = 0
    i = 1
    DO WHILE t<1000
    t = t+i
    LOOP
    But BEWARE, this will max out system resource use while it runs.

    I think the DynuWait is a free dll that you can call from your asp script. It's only gonna cost if you want to buy the source code. Of course you need to have permission to install the dll on the server for it to work
  10. #6
  11. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    5
    Rep Power
    0
    Thanks, again. That "delay timer" is what I'm using right now. But it's not a great solution for a couple reasons. First, it chews up system resources. Secondly, in order to ensure that ALL mails get sent, the timer needs to be set to a pretty high value. It seems that most mails do not need any delay at all, but some need a higher value. So, no only do I chew up system resources, but I also slow down run time by an unnecessarily long time.

    What I really need is some way to test whether each mail has been sent, and only slow the system down long enough to wait for that to happen.

    Any ideas?

    BBHoo92
  12. #7
  13. Contributing User
    ASP Scholar (3000 - 3499 posts)

    Join Date
    Jun 2004
    Posts
    3,072
    Rep Power
    190
    How about batching by page. Rather than attempting to process all the messages, process a lump of xx messages and then redirect back to the ASP script until all messages are finished. Presumably you are getting the email addresses from a database, so you should be able to flag them as sent then check the flag on the next page refresh

    MK
  14. #8
  15. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    5
    Rep Power
    0
    Interesting idea. That would probably do the trick, and might be a bit more efficient than a delay timer. The problem, though, is that there doesn't seem to be much consistency as to how many e-mails go out correctly before the first "skip". Also, if I run the sub-batches in rapid succession, I might get the same problem as before -- sending mails faster than CDONTS can keep up.

    What I really need is some testable condition to determine if an e-mail has been sent. Anyone know how to do this?

    Thanks!
  16. #9
  17. Contributing User
    ASP Scholar (3000 - 3499 posts)

    Join Date
    Jun 2004
    Posts
    3,072
    Rep Power
    190
    CDONTS, I believe, just produces an email on the server then lets it be sent via the O/S. Not sure that there is a status as such? You might need to look at the event log to find out more about why the messages are not going

    MK
  18. #10
  19. Contributing User
    ASP Scholar (3000 - 3499 posts)

    Join Date
    Jun 2004
    Posts
    3,072
    Rep Power
    190
    Digging around, it looks like CDONTS is prone to intermittent problems. I've never used it myself - I've always gone with either JMail or the Dynu email component. Maybe you should install one of these or check if they are already on your server?

    MK

Similar Threads

  1. Problem sending mail using CDONTS
    By jackypeh in forum ASP Development
    Replies: 5
    Last Post: July 1st, 2004, 10:16 PM
  2. Yet Another Sending Mail Problem!!!!???
    By thug_bugger in forum .NET Development
    Replies: 0
    Last Post: March 24th, 2004, 02:53 AM
  3. Permission Error Sending CDONTS Mail
    By Steve Schofield in forum ASP Development
    Replies: 3
    Last Post: March 22nd, 2004, 08:22 PM
  4. CDONTS not sending mail for ASP.NET (works for ASP)
    By Steve Schofield in forum .NET Development
    Replies: 1
    Last Post: April 5th, 2002, 08:27 PM
  5. Replies: 1
    Last Post: February 9th, 2002, 02:55 AM

IMN logo majestic logo threadwatch logo seochat tools logo