Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why is this repeating???

Status
Not open for further replies.

AlaskanDad

Programmer
Mar 1, 2002
188
US
I have approximately 4,500 members in my database (all have opted-in for my newsletter in case you were wondering :)) and I use the following code to send out our eNews.

When I type up a short, plain-text email it goes out without a hitch. However, this morning I sent out our lengthy HTML eNews and it ended up sending out two to each member.

Any ideas why this may be happening? Can you recommend any fixes to tighten up this code?

Our members are getting a little frustrated (as am I).

Thanks,
Rob


Code:
strEmailSQL = "xxxx_EmailAllMembers" ' I've verified this returns only one MemberID and one email address per member
	 
myEmailRS.Open strEmailSQL, Sconn, adOpenKeyset, adLockOptimistic, adCmdText
Dim EmailArray

EmailArray = myEmailRS.GetRows

myEmailRS.Close
set myEmailRS = nothing
set strEmailSQL = nothing

If Instr(1,request.form("NewInfoNote"),"<",0) > 0 Then
	HTMLSetting = 0
	AppropriateLineBreak = "<br>"
Else
	HTMLSetting = 1
	AppropriateLineBreak = vbCrLf
End If



xxxxHeader = "The following message is for all members of xxxx." _
	& AppropriateLineBreak & AppropriateLineBreak

FixedBody = request.form("NewInfoNote")
FixedTitle = request.form("NewInfoTitle")
xxxxTagLine =  _
		AppropriateLineBreak & AppropriateLineBreak & _
	"Rob Johnson" & _
		AppropriateLineBreak & _
	"Owner and Founder, XXXX" & _
		AppropriateLineBreak & _
	"[URL unfurl="true"]http://www.xxxx.com"[/URL] & _
		AppropriateLineBreak & AppropriateLineBreak & _
	"xxxx" & _
		AppropriateLineBreak & _
	"PO Box 46086" & _
		AppropriateLineBreak & _
	"xxxx, xx xxxxx" & _
		AppropriateLineBreak & AppropriateLineBreak & _
	"To remove yourself from future mailings, please click on this link or copy and " & _
	"paste it into your browser:" & _
		AppropriateLineBreak		


for i = 0 to ubound(EmailArray,2)

TagExtraTop = ""
TagExtraBottom = ""
xxxxFinalTagLine = ""

If HTMLSetting = 0 Then
TagExtraTop =  "<a href='[URL unfurl="true"]http://www.xxxx.com/RemovePage.asp?Table=Member&Email="[/URL] & _
		EmailArray(0,i) & "'>"
TagExtraBottom =  	"</a></font>"
End IF

xxxxFinalTagLine =  xxxxTagLine & _
		TagExtraTop & _
		"[URL unfurl="true"]http://www.xxxx.com/RemovePage.asp?Table=Member&Email="[/URL] & EmailArray(0,i) _
		& TagExtraBottom

        	
set mailObj = server.createObject("CDONTS.Newmail")
mailObj.TO = EmailArray(0,i)
mailObj.FROM = "Rob Johnson <Rob@xxxx.com>"
mailObj.SUBJECT = ARep(FixedTitle) & " for Member #" & EmailArray(1,i)
mailObj.BodyFormat = HTMLSetting
mailObj.MailFormat = HTMLSetting
mailObj.BODY = xxxxHeader & FixedBody & xxxxFinalTagLine
mailObj.send
set mailObj = nothing

Next
 
Hmm, I don't see anything in there that would caus that...maybe try a quick hardcoded HTML message to yourself? See if it goes duplicate ven when you hardcode the values and don't have it in a loop. If it does then it's not your code (although I'm still not sure why it would be happening...)

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top