[thelist] [ASP] Database update email notification
Tyme
nopun at bellsouth.net
Sat Jul 7 12:01:45 CDT 2001
Hello. New to this list. In advance, thank you for your help.
OBJECTIVE: Want to send email notification to a recipient list when a
particular database (sql7) table has been updated. (Thought that I'd try a
simple solution first.)
PROBLEM: The message does not appear to be sent. (I have even tried
hardcoding in the ASPMail values.) Any ideas?
ATTEMPTED SOLUTION: Thought that I could just tack on a little ASPMail code
after the objRS.Update and even have the body of email notice built from the
submitted form.
Am using an ASPMail script that I am successfully using on
another site to send an order form to Vendor. (Difference is working script
case: nothing is being recorded in a database.) Also, I am referencing an
article about email notification, but trying to apply it to my existing
code.
APPLICABLE CODE (from processing page):
objRS.AddNew
objRS("ann_type") = Request.Form("AnnType")
objRS("ann_date") = CDate(Request.Form("AnnMonth") & "/" &
Request.Form("AnnDay") & "/" & Request.Form("AnnYear"))
objRS("ann_time") = CDate(Request.Form("AnnHour") & ":" &
Request.Form("AnnMin") & " " & Request.Form("AnnAmPm"))
objRS("ann_desc") = ReplQuote(Trim(Request.Form("AnnDesc")))
objRS("ann_moreinfo") = Trim(Request.Form("AnnMoreInfo"))
objRS.Update
...
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
if mailComp = "ASPMail" then
set mailObj = Server.CreateObject("SMTPsvg.Mailer")
mailObj.FromAddress = fromAddr
mailObj.RemoteHost = smtpServer
mailObj.ReplyTo = replyTo
for each addr in Split(recipients, ",")
mailObj.AddRecipient "", Trim(addr)
next
mailObj.Subject = subject
mailObj.ContentType = "text/html"
mailObj.BodyText = body
if not mailObj.SendMail then
SendMail = "Email send failed: " & mailObj.Response & "."
end if
end if
The ASPMail variables above are derived from the Add Form thusly:
referers = Array("www.mydomain.com")
mailComp = "ASPMail"
smtpServer = "mail.hostserver.com"
fromAddr = "tyme at co.brunswick.nc.us"
<input name="_recipients" type="hidden" value="tyme at no-pun.com">
<input name="_replyToField" type="hidden" value="Email">
<input name="_subject" type="hidden" value="Brunswick County Emergency News
Update">
<input name="_requiredFields" type="hidden"
value="AnnType,AnnMonth,AnnDay,AnnYear,AnnHour,AnnMin,AnnAmPm,AnnDesc,AnnMor
eInfo">
<input name="_envars" type="hidden" value="HTTP_REFERER">
<input name="_fieldOrder" type="hidden"
value="AnnType,AnnMonth,AnnDay,AnnYear,AnnHour,AnnMin,AnnAmPm,AnnDesc,AnnMor
eInfo">
...
More information about the thelist
mailing list