×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Dreamweaver & Flash

Emailing a group from database w/Jmail by schase
Posted: 31 Mar 02

Ok, now I found similiar, This one in fact came from Stardeveloper.com  I had to modify to work - the others I found were close but it wouldnt let me email a specific "group" within my database.  This does.  The manner I came about this - Created a form on a page called sendemail.asp.

Have the following fields.
fldRecipients - the Groups name
fldSubject   - self explanitory
fldMessage   - self Explanitory
fldFrom      - This I brought the value in as the logged-in session variable.

This page submits to sendemail2.asp  This page displays everything you typed - and sends the email.  When I created the recordset - I filtered by in my case Pilot_Level, with form variable of fldRecipients.  This brought out only that group you wanted.

now sendemail.asp is a simple form entry page.  Onto SendEmail2.asp  all this goes above the <head> tags of course.  and naturally you'll have to modify to fit your fields with your group stuff, smtp server, you get the point.

<%
Dim rs__MMColParam
rs__MMColParam = "1"
if (Request.Form("fldRecipients") <> "") then rs__MMColParam = Request.Form("fldRecipients")
%>
<%
   ' Declaring variables
   Dim rs, mail, subject, message, data_source, sql_select, strImportance, no

   no = 0
   subject = Request.Form("fldsubject")
   message = Request.Form("fldmessage")
   strImportance = Request.Form("fldImportance")
   
set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_changetoyour_STRING
rs.Source = "SELECT email FROM tblPilots WHERE pilot_level = '" + Replace(rs__MMColParam, "'", "''") + "' ORDER BY callsign ASC"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
rs.Open()
rs_numRows = 0

   ' Check to see if you have not pressed the 'send' button mistakenly
   If Len(message) Then

   ' If you have written some message then lets send it
   ' You can use ASP Email component of your choice, here I will
   ' stick with JMAIL

   While Not rs.EOF
   Set JMail = Server.CreateObject("JMail.SMTPMail")
   JMail.ServerAddress = "smtp.yourdomain.com"
   JMail.ContentType = "text/html"
   Jmail.Sender = "webmaster@yourdomain.com"
   Jmail.AddRecipient rs("email")
   Jmail.Subject = subject
   Jmail.Body = message
   JMail.Priority = strImportance
   Jmail.Execute
   Set Jmail = Nothing
   no = no + 1
   rs.MoveNext
   Wend

   ' When messages have been sent to all the users, exit
   Response.Write "Emails sent to " & no & " users."


   ' Had you pressed the button mistakenly with text area empty, then
   ' redirect back to the HTML Form
   Else
   Response.Redirect "sendemail.asp"
   End If
 %>

Back to Adobe FAQ Index
Back to Adobe Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close