Click to See Complete Forum and Search --> : PLEASE HELP!!! ASP while loops with the HTML mailto: function


benmate
06-11-2004, 05:21 AM
I have the following code to send an email from a website to a large number of addresses taken from a database. I can't but them all in the "To:" box of teh email window because outlook then crashes. So I thought I could put half in the "cc:" box. but it won't work!

<a href="
mailto:
<% rscontacts.movefirst() %>
<% While (NOT rscontacts.EOF) AND counter <= 35 %>
<%=(rscontacts.Fields.item("Email").value)%>,
<% rscontacts.movenext() %>
<% counter = counter + 1 %>
<% wend %>
?cc=
<% While (NOT rscontacts.EOF) AND counter > 35 AND counter < 70 %>
<%=(rscontacts.Fields.item("Email").value)%>,
<% rscontacts.movenext() %>
<% counter = counter + 1 %>
<% wend %>
<% counter = 0 %>
">
Email the whole committee</a>

The problem is that it won't work! No errors come up but the link just doesn't do anything. The recordset names are def correct and the recordset works. Any idea what might be wrong with the code?

Thankyou for your help,

Ben

simflex
06-11-2004, 09:17 AM
What operating system are you using?
If you are pulling it from the database, your approach isn't going to work.

lmf232s
06-11-2004, 09:57 AM
Try using CDONTS.

<%
Do While Not ObjRS.EOF
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From = "AHighNinja@420.com "
MyCDONTSMail.To = "JoeSmoe@hotmail.com"
MyCDONTSMail.Subject= "I know who you are"
MyBody = "A new person has just registered. The details are : " & vbCrLf
MyBody = MyBody & "First Name :" & vbCrLf
MyBody = MyBody & "Last Name : " & vbCrLf
MyBody = MyBody & "Email : " & vbCrLf
MyBody = MyBody & "Password : " & vbCrLf
MyCDONTSMail.Body = MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
objRS.MoveNext
Loop
%>

Email this way does not cause outlook or your default email to open. This will send the email in the backgound. All you have to do is supply it the information. Have the To: section set up as either a variable read in from a DB or Hard code it.

Hope this helps.
Your server may not be able to handle CDONTS, but give it a shot. I have noticed that this method will not send to a , hotmail account but it does email to my outlook email.

buntine
06-11-2004, 11:58 AM
Furthermore, the IE mailto: command will only work for users who have Windows and have configured Outlook express.

Definetely go with one of the email components -- CDONTS, CDO, ASPEmail, etc.

Regards,
Andrew Buntine.