L
L
Below is the code to send an email message based on user selection. The only
problem is when there are duplicate states, the email message is sent 3 times
instead of 2 times. This is the correct message:
Any ideas?
------------------------
Here is your requested VAR information:
VAR Contact Name: John Peace
Company Name: AccountNet
Address: 1333 Broadway, Suite 632
City: New York
State: New York
Zip Code: 10018
Phone Number: 212-244-9009
Email Address: (e-mail address removed)
Website: http://www.accountnet.com
***************************************
VAR Contact Name: Gwen Blakemore
Company Name: Queue Associates
Address: 42 Broadway, Suite 1814
City: New York
State: New York
Zip Code: 10004
Phone Number: 212-269-1313 x232
Email Address: (e-mail address removed)
Website: http://www.queueassoc.com
***************************************
This message is sent then 1 minute later another message is sent with this
information:
Here is your requested VAR information:
VAR Contact Name: John Peace
Company Name: AccountNet
Address: 1333 Broadway, Suite 632
City: New York
State: New York
Zip Code: 10018
Phone Number: 212-244-9009
Email Address: (e-mail address removed)
Website: http://www.accountnet.com
***************************************
Here is the code:
<% .....
objRS.Open strsql, myconn
'
Do While Not objRS.EOF
'
myname = objRS("ContactName")
mycompany = objRS("CompanyName")
myaddress = objRS("ContactAddress")
mycity = objRS("ContactCity")
mystate = objRS("ContactState")
myzip = objRS("ContactZip")
myphone = objRS("ContactPhone")
myemail = objRS("ContactEmail")
myURL = objRS("ContactURL")
'
strBody = strBody & "VAR Contact Name: " & vbTab & myname & vbTab & vbCrLf
& vbCrLf
strBody = strBody & "Company Name: " &vbTab & mycompany & vbTab & vbCrLf
&vbCrLf
strBody = strBody & "Address: " &vbTab & myaddress & vbTab & vbCrLf & vbCrLf
strBody = strBody & "City: " &vbTab & mycity & vbCrLf & vbCrLf
strBody = strBody & "State: " &vbTab & mystate & vbCrLf & vbCrLf
strBody = strBody & "Zip Code: " &vbTab & myzip & vbCrLf & vbCrLf
strBody = strBody & "Phone Number: " &vbTab & myphone &vbCrLf & vbCrLf
strBody = strBody & "Email Address: " &vbTab & myemail & vbCrLf & vbCrLf
strBody = strBody & "Website: " &vbTab & myurl & vbCrLf & vbCrLf
strBody = strBody & strstars &vbTab & vbCrLf & vbCrLf
'
set myCDONTSMail = CreateObject("CDONTS.NewMail")
myCDONTSMail.Send strFrom, strTo, strSubject, strBody
set myCDONTSMail = Nothing
'
objRS.MoveNext
Loop
'
objRS.close
myconn.Close
set myconn = Nothing
%>
problem is when there are duplicate states, the email message is sent 3 times
instead of 2 times. This is the correct message:
Any ideas?
------------------------
Here is your requested VAR information:
VAR Contact Name: John Peace
Company Name: AccountNet
Address: 1333 Broadway, Suite 632
City: New York
State: New York
Zip Code: 10018
Phone Number: 212-244-9009
Email Address: (e-mail address removed)
Website: http://www.accountnet.com
***************************************
VAR Contact Name: Gwen Blakemore
Company Name: Queue Associates
Address: 42 Broadway, Suite 1814
City: New York
State: New York
Zip Code: 10004
Phone Number: 212-269-1313 x232
Email Address: (e-mail address removed)
Website: http://www.queueassoc.com
***************************************
This message is sent then 1 minute later another message is sent with this
information:
Here is your requested VAR information:
VAR Contact Name: John Peace
Company Name: AccountNet
Address: 1333 Broadway, Suite 632
City: New York
State: New York
Zip Code: 10018
Phone Number: 212-244-9009
Email Address: (e-mail address removed)
Website: http://www.accountnet.com
***************************************
Here is the code:
<% .....
objRS.Open strsql, myconn
'
Do While Not objRS.EOF
'
myname = objRS("ContactName")
mycompany = objRS("CompanyName")
myaddress = objRS("ContactAddress")
mycity = objRS("ContactCity")
mystate = objRS("ContactState")
myzip = objRS("ContactZip")
myphone = objRS("ContactPhone")
myemail = objRS("ContactEmail")
myURL = objRS("ContactURL")
'
strBody = strBody & "VAR Contact Name: " & vbTab & myname & vbTab & vbCrLf
& vbCrLf
strBody = strBody & "Company Name: " &vbTab & mycompany & vbTab & vbCrLf
&vbCrLf
strBody = strBody & "Address: " &vbTab & myaddress & vbTab & vbCrLf & vbCrLf
strBody = strBody & "City: " &vbTab & mycity & vbCrLf & vbCrLf
strBody = strBody & "State: " &vbTab & mystate & vbCrLf & vbCrLf
strBody = strBody & "Zip Code: " &vbTab & myzip & vbCrLf & vbCrLf
strBody = strBody & "Phone Number: " &vbTab & myphone &vbCrLf & vbCrLf
strBody = strBody & "Email Address: " &vbTab & myemail & vbCrLf & vbCrLf
strBody = strBody & "Website: " &vbTab & myurl & vbCrLf & vbCrLf
strBody = strBody & strstars &vbTab & vbCrLf & vbCrLf
'
set myCDONTSMail = CreateObject("CDONTS.NewMail")
myCDONTSMail.Send strFrom, strTo, strSubject, strBody
set myCDONTSMail = Nothing
'
objRS.MoveNext
Loop
'
objRS.close
myconn.Close
set myconn = Nothing
%>