I am trying to send selected records to an email stored in a field called [SuperEmail]
I have created a button in the list page and put the code in the server TAB
Here's the code:
dim arr,I, currentTable, body, rmail, arr2, data
currentTable = "doctorreports"
if keys.Count>0 then
body=""
set rmail=CreateDictionary()
for i=0 to keys.Count-1
arr=split(keys.Item(i)("DoctorRepID"),"&")
if asp_count(arr)>=0 then
set arr2=CreateDictionary()
arr2("DoctorRepID")=asp_urldecode(arr(0))
where = KeyWhere(arr2,"")
set data = dal.Table(currentTable).Query(where,"")
body=body & "Time: " & data("Time") & vbcrlf
body=body & "UserName: " & data("UserName") & vbcrlf
body=body & "RepName: " & data("RepName") & vbcrlf _
& "-------------------" & vbcrlf & vbcrlf
data.close
set data=nothing
end if
next
' send the email
rmail("to")= data("SuperEmail")
rmail("subject")="Sample subject"
rmail("body")=body
set arr = runner_mail(rmail)
result("txt") = "Emails were sent."
' if error happened print a message on the web page
if arr("mailed") then
errmsg = "Error happened:
"
errmsg = errmsg & "File: " & arr("source") & "
"
errmsg = errmsg & "Line: " & arr("number") & "
"
errmsg = errmsg & "Description: " & arr("description") & "
"
result("txt") = errmsg
end if
end if
result("txt") = params("txt") & " Sent"
When i type a hardcoded email in the code it sends successfully
But with this code it keeps giving me "Sending request to server..." without sending, i don't know where's the error