This topic is locked
[SOLVED]

 Sending a conditional email using events.asp

2/3/2009 4:20:07 PM
ASPRunnerPro General questions
S
swiersman author

All,
Using ASPRunner 4.0 I am trying to use my includes/events.asp to email an individual if two dict fields meet a criteria.
Here is my code so far:
<%
Function BeforeAdd(dict)
' Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Add form represented as 'Field name'-'Field value' pair
'** Send simple email ****

' do not forget to setup email parameters like From, SMTP server etc

' on 'Security->User login settings' dialog
If (dict("DRInput")="This is a NEW Application (Fill in ALL Fields)" and dict("Status")="Ready for TRC review") then
email="test@stsgi.com"

message="This is a test"& vbcrlf & vbcrlf

subject="DR UPDATE CONTENT SUBMISSION"

sendmail email, subject, message
End If
BeforeAdd = True
' set BeforeAdd to True if you like to proceed with adding new record

' set it to False in other case
End Function
Sub AfterAdd()
'** Redirect to another page ****

Response.Redirect "../MessageBoxes/ScheduledSubmitComplete.htm"
End Sub
Sub AfterEdit()
'** Redirect to another page ****

Response.Redirect "../MessageBoxes/ScheduledUpdateComplete.htm"
End Sub
%>
It does not work, yet does not hang on syntax. Am I missing something?
Thanks for any help,
Scott

J
Jane 2/4/2009

Scott,
your code looks good.

Please claridy what doesn't work properly.

S
swiersman author 2/4/2009

Scott,

your code looks good.

Please claridy what doesn't work properly.


The redirects work, but no email is sent....
Any ideas

J
Jane 2/5/2009

Hi,
try to debug your code printing all variables:

Response.Write "DRInput: " & dict("DRInput") & "
"

Response.Write "Status: " & dict("Status") & "
"

If (dict("DRInput")="This is a NEW Application (Fill in ALL Fields)" and dict("Status")="Ready for TRC review") then

response.write "send email here"

email="test@stsgi.com"

message="This is a test"& vbcrlf & vbcrlf

subject="DR UPDATE CONTENT SUBMISSION"
response.write email

sendmail email, subject, message
End If