Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Email to selected members in the list
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

chinh10
Junior Member

125 Posts

Posted - 20 July 2001 :  16:43:34  Show Profile
Hello,

Is it possible to send an email from a textbox to some members which I have
selected by activating a checkbox?
You can see what I mean, when you go to following page:

http://www.trainpool.com/cart3.asp

(page needs a little while to load)

Is this a hard work to do? How should I start?

Thank you in advance for every hint!


Id
Junior Member

USA
129 Posts

Posted - 20 July 2001 :  17:30:43  Show Profile  Visit Id's Homepage
i'm assuming you're using a CDONTS object, so i'll use that code

<%
Dim objEmail

Set objEmail = Server.CreateObject("CDONTS.NewMail")
objEmail.From = "Your Name<your@email.com>"
objEmail.To = GetToList
objEmail.Subject = "email"
objEmail.BodyFormat = 0
objEmail.MailFormat = 0
objEmail.body = Request.Form("textareaname")
objEmail.Send
%>


That should work for you

Now as for your loop, i would do something like this, name all your check boxes something like name1, name2, name3 and so on, and your e-mails in some hidden fields called email1, email2, email3, and so on then you can do this,

<%
'------------------
'This function'll create your send list
Function GetToList()
Dim i
Dim strsendmail
Dim stremail
For i = 1 to X 'x is the number of check boxes you have
strsendmail = "name" & i
stremail = "email" & i
Name = GetName(strsendmail)
Email = GetEmail(stremail)
If Name Then
sender = sender & Email & ";"
End If
Next
Set GetToList = sender
%>
<%
'Next you'll need a couple functions for gatherine stuff from your forms
'---------------------
Function Getname(fieldname) 'this function checks to see if an e-mail should be sent
dim blnSend
If Request.Form(fieldname) = "Y" Then
blnSend = True
Else
blnSend = Fale
End If
Set Getname = blnSend
End Function
'----------------------
Function GetEmail(emailname) 'this function gets the person's e-mail
Set GetMail = Request.Form(emailname)
End Function
%>



I'm pretty sure you can do your loop like that, but i can't remember if the request object'll work like that, someone please correct it if i'm wrong, but i do know the setting up e-mail object'll work for you the way i've coded it.

Edited by - Id on 20 July 2001 21:20:53

Edited by - Id on 20 July 2001 21:24:12

Edited by - Id on 20 July 2001 21:33:48

Edited by - Id on 21 July 2001 11:41:31
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07