Re: Email using CDO

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: JayB (jerry280_at_yahoo.com)
Date: 11/23/04


Date: Tue, 23 Nov 2004 21:56:54 GMT

I cleaned up the code big time. Also I found the connection timeout setting
on the SMTP server set to 10 minutes. After looking at the log files it
looks as though most people who received their email twice received the
second one around 10 minutes after their first one. I extended this time and
will see how it works.

Thanks!

-- 
JayB
"Jeff Dillon" <jeff@removeemergencyreporting.com> wrote in message 
news:OQK38iZ0EHA.2804@TK2MSFTNGP15.phx.gbl...
> Perhaps Server.CreateObject?  And create it only once, and reuse it? And 
> no
> need for movefirst for a default forward only cursor.
>
> Just suggesting ideas. Yes, it could be an SMTP issue..perhaps it times 
> out
> on a message, and tries again. Not sure. First, create solid code.
>
> Jeff
>
> "JayB" <jerry280@yahoo.com> wrote in message
> news:BEMod.5041$EJ.1397@news01.roc.ny...
>> Jeff,
>>
>> I'm not sure how this solves the problem. When I tested with 16 email
>> addresses, it worked fine. When I tested by writing each of the 9800 
>> email
>> addresses to the browser instead of sending the email to each, it worked
>> fine. If the extra loop was the problem, these tests would have produced
>> duplicated results.
>>
>> Is there a chance that it could be an issue with the server? There's 
>> 1.5GB
>> of RAM in it and each email message was only 11KB. Perhaps there's an
> issue
>> with the SMTP service?
>>
>> -- 
>> JayB
>>
>> "Jeff Dillon" <jeff@removeemergencyreporting.com> wrote in message
>> news:%23hXKgdY0EHA.3244@TK2MSFTNGP10.phx.gbl...
>> > Yes, remove the unneccessary loop
>> >
>> > Jeff
>> >
>> > "JayB" <jerryb@qwest.net> wrote in message
>> > news:dzxod.4440$1C3.3754@news02.roc.ny...
>> >> Sorry, I forgot that part.
>> >> After I dim the variable i, I set it to 1. I put in the for loop this
> way
>> > to
>> >> ensure that it only sent out once per record (so I thought). I did 
>> >> send
>> >> it
>> >> to 16 test email accounts from a test table using the same code and it
>> >> worked great. I also took the CDO code out and replaced it with a
>> >> response.write in an ordered html list to compare and each email
> address
>> >> appeared only once.
>> >>
>> >> -- 
>> >> JayB
>> >>
>> >>
>> >> "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
>> >> news:upZt0DP0EHA.4004@tk2msftngp13.phx.gbl...
>> >> > Well, where is the variable "number" defined and populated?  Why do
> you
>> >> > have
>> >> > two loops (do until rs.eof = true AND for i = 1 to number)?  Are you
>> >> > meaning
>> >> > to send more than copy of the newsletter to each recipient?  This
> code
>> >> > looks
>> >> > suspiciously like it could do exactly that.
>> >> >
>> >> > -- 
>> >> > http://www.aspfaq.com/
>> >> > (Reverse address to reply.)
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > "JayB" <jerry280@yahoo.com> wrote in message
>> >> > news:c_tod.4991$VT7.215@news01.roc.ny...
>> >> >> We sent out an email today to a list of subscribers from our
> database
>> >> > using
>> >> >> ASP and CDO. For some reason, many people received it twice,
> including
>> >> >> myself. I checked the database and there were do duplicate records
> and
>> > I
>> >> >> know for sure that I have no other email address forwarding email. 
>> >> >> I
>> >> > checked
>> >> >> my code and all seems ok. Perhaps someone can take a look at it and
>> >> >> see
>> >> >> if
>> >> > I
>> >> >> screwed up somewhere? It was sent to over 9,000 email addresses.
> When
>> >> >> I
>> >> > sent
>> >> >> a test email from the database to 16 internall email addresses,
>> > everyone
>> >> > got
>> >> >> it just fine and only received one copy, as planned.
>> >> >>
>> >> >> <%
>> >> >>  rs.Open SQL, ConStr
>> >> >>  rs.movefirst
>> >> >>  do until rs.eof = true
>> >> >>   strCount = strCount + 1
>> >> >>   for i=1 to number
>> >> >>    Set myMail = CreateObject("CDO.Message")
>> >> >>    myMail.From = "eNewsletter@pacer.org"
>> >> >>    myMail.To = rs("EmailAddress")
>> >> >>    myMail.Subject = "PACER eNewsletter"
>> >> >>    myMail.HTMLBody = content
>> >> >>    myMail.Send
>> >> >>    Set myMail = Nothing
>> >> >>   next
>> >> >>   rs.movenext
>> >> >>  loop
>> >> >>  rs.close
>> >> >> %>
>> >> >>
>> >> >> Before I sent the email, I tested this code by replacing everything
> in
>> >> >> the
>> >> >> for loop with a response.write strCount & " " & rs("EmailAddress")
>> >> >> just
>> >> >> to
>> >> >> make sure it doesn't write any of the email addresses more than
> once.
>> >> >>
>> >> >> Could this be an issue with the SMTP service on my server?
>> >> >>
>> >> >> Thanks,
>> >> >>
>> >> >> -- 
>> >> >> JayB
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: Threading a server
    ... SMTP. ... needed the watchdog and with a reasonable amount of time. ... I am guessing that to deal with the timeout behaviour, ... The next message you posted commented on the loop. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SMTP WEIRDNESS
    ... Jeff Cochran wrote: ... >>SMTP are the GFI MailSecurity and MailEssentials products. ... the message and since it never even registers an attempt from that ... remote server terminated the connection". ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Re: Exchange 2003 forwarding question
    ... To a certain extent based on your configured hop count in your SMTP ... "Sometimes a loop forms when an Exchange user sets up a rule to ...
    (microsoft.public.exchange.admin)
  • Re: php mailing list operation
    ... to loop a bunch because sometimes mailtakes forever to send. ... sendmail, qmail, SMTP, Exchange pickup folder, ... PS. Do not use SMTP for bulk mailing unless you do not have an ... PHP Classes - Free ready to use OOP components written in PHP ...
    (comp.lang.php)
  • Re: External E-mail Down
    ... OMIGOD, Ahl. ... the the SMTP Virtual Server to the LAN address of the SBS server! ... *Is your SMTP server set to accept all connections?* made me ...
    (microsoft.public.windows.server.sbs)