This topic is locked

SendMail function or filter by columns

5/6/2008 11:33:15 AM
ASPRunnerPro General questions
G
gossie author

Hi - Loving the product, but could someone help with the following please.

I've created a simple table of contacts for different organizations, but each organization has several different email address's. Is there a way to add a "send mail" button, but only to each group?
e.g.: My database: (Single Table)

ID OrgName Email Address1 Email Address2 Email Address3
Also, I built this using the standard wizard, so didn't really change any settings. Then when using the "auto search" box that ASPrunner has created it doesn't allow me to list only the Contacts for Email Address1. Is there a way to do that so I could then cut and paste that whole list into MS Outlook? The Search does work if I ask it to return all organizations starting with "D" for example...
So...at the bottom of each column, I would want a sendmail button. To send an email to all in EmailAddress1 etc...
How do I insert a screenshot into this topic??

J
Jane 5/7/2008

Hi,
use custom event (Insert ASP code snippet option on the Visual Editor tab) to create button.

Here is a sample:

response.write "<input type=button class=button value=send onclick=""window.location.href='tablename_list.asp?send=emailaddress1';"">"


Then select list of emails in the List page: Before process event and send email.

Here is a sample:

if request.querystring("send")="emailaddress1" then

'select list of emails

str = "select EmailAddress1 from TableName"

emails = ""

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection

while not rsTemp.eof

emails = emails & rsTemp("EmailAddress1") & ", "

rsTemp.MoveNext

wend

rsTemp.Close : set rsTemp = Nothing
emails = left(emails,Len(emails)-2)
'send email

email=emails

message="Hello there" & vbcrlf & "Best regards"

subject="Sample subject"

sendmail email, subject, message
Response.redirect "TableName_list.asp"

end if