This topic is locked

Send Email to selected records

9/28/2010 4:21:24 AM
ASPRunnerPro General questions
I
ioagia author

Hello ASPRunners,
I am using ASPRunner Professional 6.2 (Build 5242)
I have a DB with a table named CUSTOMERS.

One of the fields of table CUSTOMERS is Email
I have insert a button to the List Page of table CUSTOMERS. When i click on the button, i send an email to ALL the records of the Table (using Email field)
I use the following code...

if Request.Form("a")="email" then

set data = dal.Table("CUSTOMERS").QueryAll()
while not data.eof
'********** Send simple email ************
dim tmpDict

set tmpDict = CreateObject("Scripting.Dictionary")

tmpDict("from")="myEmail@host.com"

tmpDict("to")=data("Email")

tmpDict("subject")= subStr

tmpDict("body")= bodyStr

set ret=runner_mail(tmpDict)

if not ret("mailed") then

response.write ret("message")

end if

data.MoveNext
wend

end if


All i want to do is to send an email ONLY to checked records and NOT to all records.

Is that possible ???
Thank you!

A
ann 9/28/2010
I
ioagia author 9/28/2010

Thank you very much for your reply.
Sorry if misunderstanding but, i think my issue is different than the exaple you linked.

I dont want to send multiple records to an email address. I want to send a (constant) message to multiple records (using the Email field).
Thank you again!

Sergey Kornilov admin 9/28/2010
I
ioagia author 9/28/2010

This is exactly the code i use. (as you can see in my first post).

This code sends an email to ALL the records of a table, not to the selected records.
Thank you again, i hope i not tire you <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=53012&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />



Here is another article that can help:

http://xlinesoft.com/asprunnerpro/docs/send_email_to_email_addresses_from_user_table.htm

C
clig 9/28/2010



This is exactly the code i use. (as you can see in my first post).

This code sends an email to ALL the records of a table, not to the selected records.
Thank you again, i hope i not tire you <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=53024&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />


you need a qualifier such as update where something equals something - in other words what is "selected records" based on?

I
ioagia author 9/29/2010

I think so ...

Something to replace the QueryAll with QuerySelected!

A
ann 9/29/2010

Hi,
you can try to do it in the following way (the code from the 'Email selected records' article):

...

for i=1 to Request.Form("selection[]").Count

arr=split(Request.Form("selection[]").Item(i),"&")

if asp_count(arr)>=0 then

set keys=CreateDictionary()

keys("OrderID")=asp_urldecode(arr(0))

where = KeyWhere(keys,"")

set data = dal.Table("users").Query(where,"")

'the code from the "Send mass email to all users" article

while not data.eof

...

wend

data.close: set data=nothing

end if

next

end if

end if



If it doesn't help please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error. 'Demo Account' button can be found on the last screen in the program.