I have a form with a checkbox that when selected, the completed form is supposte to be emailed (with all the values) to all records in a table that have "Active" in the User_Status field. The form is using RTF so the email must go out in html.
Can anyone help me with this code?
' After record added
' After record added
Function AfterAdd(values,keys,inline)
bit_Send_Email = GetRequestForm("bit_Send_Email")
News_Attachment_Name = GetRequestForm("News_Attachment_Name")
News_Subject = GetRequestForm("News_Subject")
Reply_Email = GetRequestForm("Reply_Email")
Contact_Phone = GetRequestForm("Contact_Phone")
News_Message = GetRequestForm("News_Message")
Dim dict
Set dict = values
'********** Send email with new data ************
If bit_Send_Email = 1 then
dtNews_Date = GetRequestForm("News_Date")
dtNews_Time = GetRequestForm("News_Time")
dtNews_Date = FormatDateTime(dtNews_Date,vbShortDate)
dtNews_Time = FormatDateTime(dtNews_Time,vbLongTime)
strNews_Attachment_Name = News_Attachment_Name
If strNews_Attachment_Name <> "" then 'include Attachment
strAttach_Link = "http://www.mydomain.com/SFHOA/Members/files/"
strTheAttach_Name = News_Attachment_Name
strHOAAttachment = strAttach_Link + News_Attachment_Name
msg = msg & vbcrlf & "<p>Date Sent: " & News_Date & "</p><p>Time Sent: " & News_Time & "</p>"
msg = msg & vbcrlf & "<p>Subject: " & News_Subject & "</p>"
msg = msg & vbcrlf & "<p>Reply Email: " & Reply_Email & "</p>"
msg = msg & vbcrlf & "<p>Contact Phone: "& Contact_Phone & "</p>"
strAttachment_Name = News_Attachment_Name
msg = msg & "<p>Attachment Link: " & strHOAAttachment & "</a>" & "</p>"
msg = msg & vbcrlf & "Message: " & News_Message & "</p>"
set tmpDict = CreateObject("Scripting.Dictionary")
tmpDict("to")="test@test.com"
set ret=runner_mail(tmpDict)
';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Response.Flush
On Error Resume Next
SET conn = Server.CreateObject("ADODB.Connection")
conn.Open "", ""
strSql = "SELECT DISTINCT Primary_Email_Address FROM HOME_OWNERS WHERE ((User_Status)='Active')"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSql, conn, 3, 3
On Error Resume Next
rs.MoveFirst
Do while not rs.EOF
strEmail = rs("Primary_Email_Address")
On Error Resume Next
If strEmail <> "" then
'*'*'*'*'*'*'*'*'*'*'*'*'*'* SEND EMAIL TO ALL USERS '*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*
sendmail strEmail, News_Subject, msg'*'*'*'*'*'*'*'*'*'*'*'*'*'*'
End If
strEmail = ""
rs.MoveNext
loop
rs.close
set rs=Nothing
End If 'If dict("bit_Send_Email") = 1 then
'********** Redirect to another page ************
'Response.Redirect "NEWS_RELEASES_list.asp"
End Function ' AfterAdd
arrAvailableEvents("AfterAdd")=true