473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Email using CDO

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 = "eN*********@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
Jul 22 '05 #1
8 1894
Isn't it possible that someone ran the script twice or two people ran it
once?

Ray at work

"JayB" <je******@yahoo.com> wrote in message
news:c_****************@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 = "eN*********@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

Jul 22 '05 #2
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" <je******@yahoo.com> wrote in message
news:c_****************@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 = "eN*********@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

Jul 22 '05 #3
No. I'm the only one who has access to it. I wish that scenerio were
possible though ;-)

--
JayB

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:up**************@TK2MSFTNGP10.phx.gbl...
Isn't it possible that someone ran the script twice or two people ran it
once?

Ray at work

"JayB" <je******@yahoo.com> wrote in message
news:c_****************@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 = "eN*********@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


Jul 22 '05 #4
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]" <te*****@dnartreb.noraa> wrote in message
news:up**************@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" <je******@yahoo.com> wrote in message
news:c_****************@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 = "eN*********@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


Jul 22 '05 #5
Yes, remove the unneccessary loop

Jeff

"JayB" <je****@qwest.net> wrote in message
news:dz*****************@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]" <te*****@dnartreb.noraa> wrote in message
news:up**************@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" <je******@yahoo.com> wrote in message
news:c_****************@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 = "eN*********@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



Jul 22 '05 #6
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" <je**@removeemergencyreporting.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yes, remove the unneccessary loop

Jeff

"JayB" <je****@qwest.net> wrote in message
news:dz*****************@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]" <te*****@dnartreb.noraa> wrote in message
news:up**************@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" <je******@yahoo.com> wrote in message
> news:c_****************@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 = "eN*********@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
>>
>>
>
>



Jul 22 '05 #7
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" <je******@yahoo.com> wrote in message
news:BE****************@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" <je**@removeemergencyreporting.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yes, remove the unneccessary loop

Jeff

"JayB" <je****@qwest.net> wrote in message
news:dz*****************@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]" <te*****@dnartreb.noraa> wrote in message
news:up**************@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" <je******@yahoo.com> wrote in message
> news:c_****************@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 = "eN*********@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
>>
>>
>
>



Jul 22 '05 #8
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" <je**@removeemergencyreporting.com> wrote in message
news:OQ**************@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" <je******@yahoo.com> wrote in message
news:BE****************@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" <je**@removeemergencyreporting.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Yes, remove the unneccessary loop
>
> Jeff
>
> "JayB" <je****@qwest.net> wrote in message
> news:dz*****************@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]" <te*****@dnartreb.noraa> wrote in message
>> news:up**************@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" <je******@yahoo.com> wrote in message
>> > news:c_****************@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 = "eN*********@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
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Chuck Anderson | last post by:
Can anyone point me in the right direction? I want to use Php to automate confirmation of someone joining an email list by them replying to an email (so they don't have to have a browser?). I...
7
by: BenignVanilla | last post by:
My ISP provides a web based email client, but it is not brandable and the features are not that extensive. I'd like to build my own. Has anyone done this, or is anyone aware of any tools out there...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
117
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
9
by: Bob Jones | last post by:
We have developed a commercial ASP.net application (personal nutrition management and tracking); we want to send smtp email from within it. For our development box, we use WinXP Pro, IIS 5.5,...
3
by: Frank | last post by:
I am attempting to develop a solution where I handle bounced e-mails. I wish to field all bounced emails in a custom email account such a bounced@mycompany.com From the aricle at...
9
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
4
Frinavale
by: Frinavale | last post by:
Introduction Many .NET applications will require an email be sent out for various reasons. This article will give a quick examples on how to send an email using VB.NET. The examples given can...
3
by: anu b | last post by:
Hii I am using System.net.mail for sending email... i need to send a webpage with its html content as my email body .....for that i used mail.Isbodyhtml as true...but it is not working for me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.