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.
[color blue]
<%
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
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
%>
[/color]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.